a3870b2ca49c9968b5c247f8515d64ae070656aa
[ccsdk/oran.git] /
1 /*-
2  * ========================LICENSE_START=================================
3  * ONAP : ccsdk oran
4  * ======================================================================
5  * Copyright (C) 2019-2020 Nordix Foundation. All rights reserved.
6  * ======================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ========================LICENSE_END===================================
19  */
20
21 package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
22
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.google.gson.annotations.SerializedName;
25
26 import io.swagger.v3.oas.annotations.media.Schema;
27
28 @Schema(name = "policy_info_v2", description = "Information for one A1-P Policy")
29 public class PolicyInfo {
30
31     @Schema(name = "policy_id", description = "identity of the policy", required = true)
32     @JsonProperty(value = "policy_id", required = true)
33     @SerializedName("policy_id")
34     public String policyId;
35
36     @Schema(name = "policytype_id", description = "identity of the policy type", required = true)
37     @JsonProperty(value = "policytype_id", required = true)
38     @SerializedName("policytype_id")
39     public String policyTypeId;
40
41     @Schema(name = "ric_id", description = "identity of the target Near-RT RIC", required = true)
42     @JsonProperty(value = "ric_id", required = true)
43     @SerializedName("ric_id")
44     public String ricId;
45
46     @Schema(name = "policy_data", description = "the configuration of the policy", required = true)
47     @JsonProperty(value = "policy_data", required = true)
48     @SerializedName("policy_data")
49     public Object policyData;
50
51     private static final String SERVICE_ID_DESCRIPTION = "the identity of the service owning the policy."
52             + " This can be used to group the policies (it is possible to get all policies associated to a service)."
53             + " Note that the service does not need to be registerred.";
54
55     @Schema(name = "service_id", description = SERVICE_ID_DESCRIPTION, required = false, defaultValue = "")
56     @JsonProperty(value = "service_id", required = false)
57     @SerializedName("service_id")
58     public String serviceId = "";
59
60     @Schema(name = "transient",
61             description = "if true, the policy is deleted at RIC restart. If false, its value is maintained by this service until explicitly deleted. Default false.",
62             required = false, defaultValue = "false", example = "false")
63     @JsonProperty(value = "transient", required = false, defaultValue = "false")
64     @SerializedName("transient")
65     public boolean isTransient = false;
66
67     @Schema(name = "status_notification_uri", description = "Callback URI for policy status updates", required = false,
68             defaultValue = "")
69     @JsonProperty(value = "status_notification_uri", required = false)
70     @SerializedName("status_notification_uri")
71     public String statusNotificationUri = "";
72
73     PolicyInfo() {}
74
75     public boolean validate() {
76         return policyId != null && policyTypeId != null && ricId != null && policyData != null && serviceId != null;
77     }
78
79 }