-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Service offering category feature #12144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Hanarion
wants to merge
22
commits into
apache:main
Choose a base branch
from
Hanarion:service_offering_category_feature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e1e902d
Add service offering category management functionality
6519904
Add service offering category selection and management functionality
55f622e
Refactor service offering category command imports for consistency
f6b5e15
This change should not have been commited, part of a debug test
8e751ce
We can't search for category, only categoryid
e3f09e6
Merge branch 'apache:main' into service_offering_category_feature
Hanarion f345279
Refactor imports again (I should fix my IDE settings...)
e964ad3
Merge remote-tracking branch 'origin/service_offering_category_featur…
14724b7
Refactor imports
64651c5
Refactor imports again (I should fix my IDE settings...)
67e238b
Refactor imports
77f821f
Merge branch 'service_offering_category_feature' of github.com:Hanari…
2cdf59a
Fixing categoryId being inconsistent following refactoring of names, …
969debd
Fixing schema sql files
4ff6cf3
Merge branch 'main' into service_offering_category_feature
Hanarion bbbf8f8
Merge branch 'main' into service_offering_category_feature
Hanarion 9eef3c5
Fixing EOF issues when pre-commit
104cb32
Merge remote-tracking branch 'upstream/main' into service_offering_ca…
ba7b6dc
Fixing ConfigurationManagerImpl to implement offering categories
716d823
Fixing loading of category in add and clone compute offering
92a7ac4
Merge branch 'main' into service_offering_category_feature
Hanarion 066cc1f
Apply suggestions from copilot code review
Hanarion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,4 +146,6 @@ enum StorageType { | |
| Long getVgpuProfileId(); | ||
|
|
||
| Integer getGpuCount(); | ||
|
|
||
| long getCategoryId(); | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
api/src/main/java/com/cloud/offering/ServiceOfferingCategory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 com.cloud.offering; | ||
|
|
||
| import org.apache.cloudstack.api.Identity; | ||
| import org.apache.cloudstack.api.InternalIdentity; | ||
|
|
||
| public interface ServiceOfferingCategory extends Identity, InternalIdentity { | ||
|
|
||
| String getName(); | ||
|
|
||
| void setName(String name); | ||
|
|
||
| int getSortKey(); | ||
|
|
||
| void setSortKey(int sortKey); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...va/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCategoryCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 org.apache.cloudstack.api.command.admin.offering; | ||
|
|
||
| import org.apache.cloudstack.api.APICommand; | ||
| import org.apache.cloudstack.api.ApiConstants; | ||
| import org.apache.cloudstack.api.ApiErrorCode; | ||
| import org.apache.cloudstack.api.BaseCmd; | ||
| import org.apache.cloudstack.api.Parameter; | ||
| import org.apache.cloudstack.api.ServerApiException; | ||
| import org.apache.cloudstack.api.response.ServiceOfferingCategoryResponse; | ||
|
|
||
| import com.cloud.offering.ServiceOfferingCategory; | ||
| import com.cloud.user.Account; | ||
|
|
||
| @APICommand(name = "createServiceOfferingCategory", | ||
| description = "Creates a service offering category.", | ||
| responseObject = ServiceOfferingCategoryResponse.class, | ||
| since = "4.23.0", | ||
| requestHasSensitiveInfo = false, | ||
| responseHasSensitiveInfo = false) | ||
| public class CreateServiceOfferingCategoryCmd extends BaseCmd { | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| //////////////// API parameters ///////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Parameter(name = ApiConstants.NAME, | ||
| type = CommandType.STRING, | ||
| required = true, | ||
| description = "the name of the service offering category") | ||
| private String name; | ||
|
|
||
| @Parameter(name = ApiConstants.SORT_KEY, | ||
| type = CommandType.INTEGER, | ||
| description = "sort key of the service offering category, default is 0") | ||
| private Integer sortKey; | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| /////////////////// Accessors /////////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public Integer getSortKey() { | ||
| return sortKey; | ||
| } | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| /////////////// API Implementation/////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Override | ||
| public void execute() { | ||
| ServiceOfferingCategory result = _configService.createServiceOfferingCategory(this); | ||
| if (result != null) { | ||
| ServiceOfferingCategoryResponse response = _responseGenerator.createServiceOfferingCategoryResponse(result); | ||
| response.setResponseName(getCommandName()); | ||
| setResponseObject(response); | ||
| } else { | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering category"); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public long getEntityOwnerId() { | ||
| return Account.ACCOUNT_ID_SYSTEM; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...va/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCategoryCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 org.apache.cloudstack.api.command.admin.offering; | ||
|
|
||
| import org.apache.cloudstack.api.APICommand; | ||
| import org.apache.cloudstack.api.ApiConstants; | ||
| import org.apache.cloudstack.api.ApiErrorCode; | ||
| import org.apache.cloudstack.api.BaseCmd; | ||
| import org.apache.cloudstack.api.Parameter; | ||
| import org.apache.cloudstack.api.ServerApiException; | ||
| import org.apache.cloudstack.api.response.ServiceOfferingCategoryResponse; | ||
| import org.apache.cloudstack.api.response.SuccessResponse; | ||
|
|
||
| import com.cloud.user.Account; | ||
|
|
||
| @APICommand(name = "deleteServiceOfferingCategory", | ||
| description = "Deletes a service offering category.", | ||
| responseObject = SuccessResponse.class, | ||
| since = "4.23.0", | ||
| requestHasSensitiveInfo = false, | ||
| responseHasSensitiveInfo = false) | ||
| public class DeleteServiceOfferingCategoryCmd extends BaseCmd { | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| //////////////// API parameters ///////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Parameter(name = ApiConstants.ID, | ||
| type = CommandType.UUID, | ||
| entityType = ServiceOfferingCategoryResponse.class, | ||
| required = true, | ||
| description = "the ID of the service offering category") | ||
| private Long id; | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| /////////////////// Accessors /////////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| public Long getId() { | ||
| return id; | ||
| } | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| /////////////// API Implementation/////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Override | ||
| public void execute() { | ||
| boolean result = _configService.deleteServiceOfferingCategory(this); | ||
| if (result) { | ||
| SuccessResponse response = new SuccessResponse(getCommandName()); | ||
| setResponseObject(response); | ||
| } else { | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering category"); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public long getEntityOwnerId() { | ||
| return Account.ACCOUNT_ID_SYSTEM; | ||
| } | ||
|
Copilot marked this conversation as resolved.
|
||
| } | ||
71 changes: 71 additions & 0 deletions
71
...va/org/apache/cloudstack/api/command/admin/offering/ListServiceOfferingCategoriesCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
| package org.apache.cloudstack.api.command.admin.offering; | ||
|
|
||
| import org.apache.cloudstack.api.APICommand; | ||
| import org.apache.cloudstack.api.ApiConstants; | ||
| import org.apache.cloudstack.api.BaseListCmd; | ||
| import org.apache.cloudstack.api.Parameter; | ||
| import org.apache.cloudstack.api.response.ListResponse; | ||
| import org.apache.cloudstack.api.response.ServiceOfferingCategoryResponse; | ||
|
|
||
| @APICommand(name = "listServiceOfferingCategories", | ||
| description = "Lists service offering categories.", | ||
| responseObject = ServiceOfferingCategoryResponse.class, | ||
| since = "4.23.0", | ||
| requestHasSensitiveInfo = false, | ||
| responseHasSensitiveInfo = false) | ||
| public class ListServiceOfferingCategoriesCmd extends BaseListCmd { | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| //////////////// API parameters ///////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Parameter(name = ApiConstants.ID, | ||
| type = CommandType.UUID, | ||
| entityType = ServiceOfferingCategoryResponse.class, | ||
| description = "ID of the service offering category") | ||
| private Long id; | ||
|
|
||
| @Parameter(name = ApiConstants.NAME, | ||
| type = CommandType.STRING, | ||
| description = "name of the service offering category") | ||
| private String name; | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| /////////////////// Accessors /////////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| public Long getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| ///////////////////////////////////////////////////// | ||
| /////////////// API Implementation/////////////////// | ||
| ///////////////////////////////////////////////////// | ||
|
|
||
| @Override | ||
| public void execute() { | ||
| ListResponse<ServiceOfferingCategoryResponse> response = _queryService.listServiceOfferingCategories(this); | ||
| response.setResponseName(getCommandName()); | ||
| setResponseObject(response); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.