Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

SPOTAUT-9153 Implementation of EMR Scaler Routes #133

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

pfz168
Copy link
Contributor

@pfz168 pfz168 commented Feb 9, 2022

This is the default pull request template. You can customize it by adding a pull_request_template.md at the root of your repo or inside the .github folder.

Jira Ticket

Include a link to your Jira Ticket
Example: JIRAISS-1234

Demo

Please add a recording of the feature/bug fix in work. if you added new routes, the recording should show the request and response for each new/changed route

Checklist:

  • I have filled relevant self assessment (NodeJS, Frontend, Backend)
  • I have run ESlint on my changes and fixed all warnings and errors (NodeJS & Frontend Services)
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have validated all the requirements in the Jira task were answered
  • I have all neccessary approvals for the design/mini design of this task
  • I have approved the API changes and granular permission patterns (documentation subtask) (For public services only)

*
* @return a list of Scaler cluster
*/
public List<ApiMrScalerListScalersAws> listMrScalers(ApiMrScalerListMrScalersRequest mrScalerListScalersRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the ApiMrScalerListMrScalersRequest object. We can directly pass the MrScalerId.

*
* @return a list of instances
*/
public List<ApiMrScalerScaleUpAws> scaleUpMrScaler(ApiMrScalerScaleUpRequest mrScalerScaleUpRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the ApiMrScalerScaleUpRequest object. We can directly pass the MrScalerId and adjustment

*
* @return a list of instances
*/
public List<ApiMrScalerScaleDownAws> scaleDownMrScaler(ApiMrScalerScaleDownRequest mrScalerScaleDownRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as previous function.

*
* @return a list of instances
*/
public List<ApiMrScalerListInstancesAws> listMrScalerInstances(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should return BL object list

*
* @return a list of instances
*/
public List<ApiMrScalerListInstancesAws> listMrScalerInstances(
Copy link
Contributor

Choose a reason for hiding this comment

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

Client class shouldn't have any reference of Api level objects.

* @return a list of Scaler cluster
*/
public List<ApiMrScalerListScalersAws> listMrScalers(ApiMrScalerListMrScalersRequest mrScalerListScalersRequest) {
List<ApiMrScalerListScalersAws> retVal;
Copy link
Contributor

Choose a reason for hiding this comment

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

Client class shouldn't have any reference of Api level objects.

public List<ApiMrScalerListScalersAws> listMrScalers(ApiMrScalerListMrScalersRequest mrScalerListScalersRequest) {
List<ApiMrScalerListScalersAws> retVal;
String clusterToGet = mrScalerListScalersRequest.getMrScalerId();
RepoGenericResponse<List<ApiMrScalerListScalersAws>> mrScalerListScalers = getSpotinstMrScalerListScalersRepo().listMrScalers(clusterToGet, authToken, account);
Copy link
Contributor

Choose a reason for hiding this comment

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

Client class shouldn't have any reference of Api level objects.

*
* @return a list of instances
*/
public List<ApiMrScalerScaleDownAws> scaleDownMrScaler(ApiMrScalerScaleDownRequest mrScalerScaleDownRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Client class shouldn't have any reference of Api level objects.


@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BlMrScalerListInstancesAws {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove Bl from class name.


@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BlMrScalerListScalersAws {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove Bl from class name.


@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BlMrScalerScaleDownAws {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove Bl from class name.


@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BlMrScalerScaleUpAws {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove Bl from class name.

import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerListInstancesAws;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.BlMrScalerListInstancesAws;

public class MrScalerListInstancesConverter {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we combine all 8 converter functions to single file/class.

public class SpotinstMrScalerListInstancesRepo implements ISpotinstMrScalerListInstancesRepo {

@Override
public RepoGenericResponse<List<ApiMrScalerListInstancesAws>> listMrScalerInstances(String mrScalerId, String authToken, String account) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Repo classes should return bl object list

public class SpotinstMrScalerListScalersRepo implements ISpotinstMrScalerListScalersRepo {

@Override
public RepoGenericResponse<List<ApiMrScalerListScalersAws>> listMrScalers(String mrScalerId, String authToken, String account) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Repo classes should return bl object list

public class SpotinstMrScalerScaleDownRepo implements ISpotinstMrScalerScaleDownRepo {

@Override
public RepoGenericResponse<List<ApiMrScalerScaleDownAws>> scaleDownMrScaler(String mrScalerId, Integer adjustment, String authToken, String account) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Repo classes should return bl object list

public class SpotinstMrScalerScaleUpRepo implements ISpotinstMrScalerScaleUpRepo {

@Override
public RepoGenericResponse<List<ApiMrScalerScaleUpAws>> scaleUpMrScaler(String mrScalerId, Integer adjustment, String authToken, String account) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Repo classes should return bl object list


import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerListInstancesAws;

public class ApiMrScalerListInstancesRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this class is not required.


import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerListScalersAws;

public class ApiMrScalerListMrScalersRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this class is not required.


import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerScaleDownAws;

public class ApiMrScalerScaleDownRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this class is not required. This can be passed as parameters itself.


import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerScaleUpAws;

public class ApiMrScalerScaleUpRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this class is not required. This can be passed as parameters itself.

import com.spotinst.sdkjava.client.response.BaseServiceItemsResponse;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.BlMrScalerListInstancesAws;

public class ApiMrScalerListInstancesResponse extends BaseServiceItemsResponse<BlMrScalerListInstancesAws> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems incorrect Bl object is extended to Api response.

import com.spotinst.sdkjava.client.response.BaseServiceItemsResponse;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.BlMrScalerListScalersAws;

public class ApiMrScalerListMrScalersResponse extends BaseServiceItemsResponse<BlMrScalerListScalersAws> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems incorrect Bl object is extended to Api response.

import com.spotinst.sdkjava.client.response.BaseServiceItemsResponse;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.BlMrScalerScaleDownAws;

public class ApiMrScalerScaleDownResponse extends BaseServiceItemsResponse<BlMrScalerScaleDownAws> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems incorrect Bl object is extended to Api response.

import com.spotinst.sdkjava.client.response.BaseServiceItemsResponse;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.BlMrScalerScaleUpAws;

public class ApiMrScalerScaleUpResponse extends BaseServiceItemsResponse<BlMrScalerScaleUpAws> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems incorrect Bl object is extended to Api response.

import java.util.Map;

public class SpotinstMrScalerListInstancesService extends BaseSpotinstService {
public static List<BlMrScalerListInstancesAws> listMrScalerInstances(String clusterId, String authToken, String account)
Copy link
Contributor

@anuragsharma-123 anuragsharma-123 Feb 10, 2022

Choose a reason for hiding this comment

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

Should return api object list
Don;t need 4 separate classes, this can be incorporated in the existing service class for MrScalers

SDK Changes
Copy link
Contributor

@janetlinkiruba janetlinkiruba left a comment

Choose a reason for hiding this comment

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

please fix the comments

@@ -1,7 +1,10 @@
package com.spotinst.sdkjava.model;

import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerAws;
import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerAwsCreationRequest;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.MrScalerAws;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this class required now?

package com.spotinst.sdkjava.model.service.mrScaler.aws;

import com.spotinst.sdkjava.client.response.BaseSpotinstService;
import com.spotinst.sdkjava.client.rest.RestClient;
Copy link
Contributor

Choose a reason for hiding this comment

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

All the MrScaler routes can be in same service class right?

BlMrScalerOperatorResponse retVal = null;
public static ApiMrScalerOperatorAwsResponse createMrScalerOperator(MrScalerOperatorAws mrScalerOperatorAws,
String authToken,
String account) throws SpotinstHttpException {
Copy link
Contributor

Choose a reason for hiding this comment

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

For MrScalerOperator keep one service class

import com.spotinst.sdkjava.model.bl.mrScaler.aws.MrScalerOperatorAws;

public class MrScalerOperatorAwsRequest {
// @JsonProperty("mrScalerOperator")
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this commented line

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this class?

Copy link
Contributor

Choose a reason for hiding this comment

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

This can be passed directly without request class


public class MrScalerListMrScalersRequest {
//region Members
private String mrScalerId;
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need this request class

Copy link
Contributor

Choose a reason for hiding this comment

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

This can be passed directly without request class

import com.spotinst.sdkjava.model.api.mrScaler.aws.ApiMrScalerOperatorAwsResponse;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.MrScalerOperatorResponse;

public class SpotinstMrScalerAwsOperatorRepo implements ISpotinstMrScalerOperatorAwsRepo {
Copy link
Contributor

Choose a reason for hiding this comment

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

we can club all the functions into one repo class for MrScalerOperator

private String id;
private String availabilityZone;
private String state;
private Date createdAt;
Copy link
Contributor

Choose a reason for hiding this comment

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

align this

private List<String> instanceTypes;
private ElastigroupCapacityConfiguration capacity;
private String lifeCycle;
private MrScalerAwsEbsConfiguration ebsConfiguration;
Copy link
Contributor

Choose a reason for hiding this comment

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

align this

@@ -18,7 +18,7 @@
/**
* Created by aharontwizer on 7/27/15.
*/
class SpotinstElastigroupService extends BaseSpotinstService {
public class SpotinstElastigroupService extends BaseSpotinstService {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this class changed to public

package com.spotinst.sdkjava.model;

import com.spotinst.sdkjava.exception.SpotinstNotSupportedException;
import com.spotinst.sdkjava.model.bl.mrScaler.aws.MrScalerScaleUpAws;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not required to be separate interface for each function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants