d941149f30979d1ccedd5b4bf31a469db867f652
[sdc.git] /
1 /*
2  * Copyright © 2016-2017 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdc.vendorsoftwareproduct.errors;
18
19 import org.openecomp.sdc.common.errors.ErrorCategory;
20 import org.openecomp.sdc.common.errors.ErrorCode;
21
22 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING;
23 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING;
24 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING;
25 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING;
26 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DELETE_IMAGE_NOT_ALLOWED;
27 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING;
28
29 public class NotSupportedHeatOnboardMethodErrorBuilder {
30   private static final String ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
31       "NIC cannot be added for VSPs onboarded with HEAT.";
32   private static final String ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
33       "Compute flavor cannot be added for VSPs onboarded with HEAT.";
34   private static final String IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG =
35       "Image cannot be added for VSPs onboarded with HEAT.";
36   private static final String DELETE_IMAGE_NOT_ALLOWED_MSG =
37       "Image cannot be deleted for VSPs onboarded with HEAT.";
38   private static final String DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG =
39           "Deployment Flavor cannot be deleted for VSPs onboarded with HEAT.";
40   private static final String EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG =
41       "Deployment Flavor cannot be edited for VSPs onboarded with HEAT.";
42
43   private NotSupportedHeatOnboardMethodErrorBuilder() {
44     
45   }
46
47
48   public static ErrorCode getAddNicNotSupportedHeatOnboardMethodErrorBuilder() {
49     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
50     builder.withId(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING);
51     builder.withCategory(ErrorCategory.APPLICATION);
52     builder.withMessage(ADD_NIC_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
53     return builder.build();
54   }
55
56   public static ErrorCode getAddComputeNotSupportedHeatOnboardMethodErrorBuilder() {
57     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
58     builder.withId(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
59     builder.withCategory(ErrorCategory.APPLICATION);
60     builder.withMessage(ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
61     return builder.build();
62   }
63
64   public static ErrorCode getAddImageNotSupportedHeatOnboardMethodErrorBuilder() {
65     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
66     builder.withId(ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING);
67     builder.withCategory(ErrorCategory.APPLICATION);
68     builder.withMessage(IMAGE_ADD_NOT_ALLOWED_IN_HEAT_ONBOARDING_MSG);
69     return builder.build();
70   }
71
72   public static ErrorCode getDelImageNotSupportedHeatOnboardMethodErrorBuilder() {
73     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
74     builder.withId(DELETE_IMAGE_NOT_ALLOWED);
75     builder.withCategory(ErrorCategory.APPLICATION);
76     builder.withMessage(DELETE_IMAGE_NOT_ALLOWED_MSG);
77     return builder.build();
78   }
79
80   public static ErrorCode getDelDeploymentFlavorNotSupportedHeatOnboardMethodErrorBuilder() {
81     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
82     builder.withId(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
83     builder.withCategory(ErrorCategory.APPLICATION);
84     builder.withMessage(DELETE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG);
85     return builder.build();
86   }
87
88   public static ErrorCode getUpdateDfNotSupportedHeatOnboardMethodErrorBuilder() {
89     ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
90     builder.withId(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING);
91     builder.withCategory(ErrorCategory.APPLICATION);
92     builder.withMessage(EDIT_DEPLOYMENT_FLAVOR_NOT_ALLOWED_MSG);
93     return builder.build();
94   }
95
96 }