summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicInternalNetworkErrorBuilder.java
blob: 2acfde48ffcd641ca8de6b184173fa88e1981b0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package org.openecomp.sdc.vendorsoftwareproduct.errors;

import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;

import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NETWORK_TYPE_UPDATE_NOT_ALLOWED;

public class NicInternalNetworkErrorBuilder {
  private static final String NULL_NETWORKID_NOT_ALLOWED_MSG =
      "Internal Networks are currently not supported for VSP created Manually, so please fix all the NIC to be of Type External and re-submit the VSP.";

  private static final String NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG =
      "Invalid request, Network Description not allowed for Internal Networks";
  private static final String NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG =
          "Invalid request, Network Type Update not allowed for a Nic";


  public static ErrorCode getNicNullNetworkIdInternalNetworkIdErrorBuilder(){
    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
    builder.withId(VendorSoftwareProductErrorCodes.NULL_NETWORKID_NOT_ALLOWED);
    builder.withCategory(ErrorCategory.APPLICATION);
    builder.withMessage(String.format(NULL_NETWORKID_NOT_ALLOWED_MSG));
    return builder.build();
  }


  public static ErrorCode getNetworkDescriptionInternalNetworkErrorBuilder(){
    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
    builder.withId(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK);
    builder.withCategory(ErrorCategory.APPLICATION);
    builder.withMessage(String.format(NETWORK_DESCRIPTION_NOT_ALLOWED_FOR_INTERNAL_NETWORK_MSG));
    return builder.build();
  }


  public static ErrorCode getNetworkTypeErrorBuilder(){
    ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
    builder.withId(NETWORK_TYPE_UPDATE_NOT_ALLOWED);
    builder.withCategory(ErrorCategory.APPLICATION);
    builder.withMessage(String.format(NETWORK_TYPE_UPDATE_NOT_ALLOWED_MSG));
    return builder.build();
  }


}