Skip to content

Commit 99f8c7d

Browse files
committed
following things are done:
1. Registerdnsrecordforvm api 2. removednsrecordforvm api 3. cleanup; fixed license, dao logic
1 parent c5972ae commit 99f8c7d

24 files changed

Lines changed: 488 additions & 73 deletions

api/src/main/java/com/cloud/configuration/Resource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ enum ResourceType { // All storage type resources are allocated_storage and not
3838
backup_storage("backup_storage", 13),
3939
bucket("bucket", 14),
4040
object_storage("object_storage", 15),
41-
gpu("gpu", 16);
41+
gpu("gpu", 16),
42+
dns_zone("dns_zone", 17);
4243

4344
private String name;
4445
private int ordinal;

api/src/main/java/com/cloud/user/ResourceLimitService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public interface ResourceLimitService {
5656
"The default maximum number of GPU devices that can be used for a domain", false);
5757
static final ConfigKey<Long> DefaultMaxProjectGpus = new ConfigKey<>("Project Defaults",Long.class,"max.project.gpus","20",
5858
"The default maximum number of GPU devices that can be used for a project", false);
59+
ConfigKey<Long> DefaultMaxDnsAccounts = new ConfigKey<>("Account Defaults",Long.class, "max.account.dns_zones","10",
60+
"The default maximum number of DNS zones that can be created by an Account", true);
5961

6062
static final List<ResourceType> HostTagsSupportingTypes = List.of(ResourceType.user_vm, ResourceType.cpu, ResourceType.memory, ResourceType.gpu);
6163
static final List<ResourceType> StorageTagsSupportingTypes = List.of(ResourceType.volume, ResourceType.primary_storage);

api/src/main/java/org/apache/cloudstack/api/command/user/dns/AddDnsServerCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
import org.apache.cloudstack.dns.DnsServer;
3434
import org.apache.commons.lang3.BooleanUtils;
3535

36-
@APICommand(name = "addDnsServer", description = "Adds a new external DNS server",
37-
responseObject = DnsServerResponse.class, requestHasSensitiveInfo = true)
36+
@APICommand(name = "addDnsServer", description = "Adds a new external DNS server", responseObject = DnsServerResponse.class,
37+
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.23.0")
3838
public class AddDnsServerCmd extends BaseCmd {
3939

4040
@Inject

api/src/main/java/org/apache/cloudstack/api/command/user/dns/AssociateDnsZoneToNetworkCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
import com.cloud.exception.ResourceUnavailableException;
3535

3636
@APICommand(name = "associateDnsZoneToNetwork", description = "Associates a DNS Zone with a Network for VM auto-registration",
37-
responseObject = DnsZoneNetworkMapResponse.class, requestHasSensitiveInfo = false)
37+
responseObject = DnsZoneNetworkMapResponse.class, requestHasSensitiveInfo = false,
38+
responseHasSensitiveInfo = false, since = "4.23.0")
3839
public class AssociateDnsZoneToNetworkCmd extends BaseCmd {
3940

4041
@Parameter(name = ApiConstants.DNS_ZONE_ID, type = CommandType.UUID, entityType = DnsZoneResponse.class,

api/src/main/java/org/apache/cloudstack/api/command/user/dns/CreateDnsRecordCmd.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.cloudstack.api.command.user.dns;
219

320
import java.util.List;
@@ -18,7 +35,8 @@
1835
import com.cloud.utils.EnumUtils;
1936

2037
@APICommand(name = "createDnsRecord", description = "Creates a DNS record directly on the provider",
21-
responseObject = DnsRecordResponse.class)
38+
responseObject = DnsRecordResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
39+
since = "4.23.0")
2240
public class CreateDnsRecordCmd extends BaseAsyncCmd {
2341

2442
@Parameter(name = ApiConstants.DNS_ZONE_ID, type = CommandType.UUID, entityType = DnsZoneResponse.class, required = true,

api/src/main/java/org/apache/cloudstack/api/command/user/dns/CreateDnsZoneCmd.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.cloudstack.api.command.user.dns;
219

320
import javax.inject.Inject;
@@ -19,10 +36,9 @@
1936
import com.cloud.exception.ResourceAllocationException;
2037

2138
@APICommand(name = "createDnsZone", description = "Creates a new DNS Zone on a specific server",
22-
responseObject = DnsZoneResponse.class,
23-
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
39+
responseObject = DnsZoneResponse.class, requestHasSensitiveInfo = false,
40+
responseHasSensitiveInfo = false, since = "4.23.0")
2441
public class CreateDnsZoneCmd extends BaseAsyncCreateCmd {
25-
private static final String COMMAND_RESPONSE_NAME = "creatednszoneresponse";
2642

2743
@Inject
2844
DnsProviderManager dnsProviderManager;
@@ -109,11 +125,6 @@ public void execute() {
109125
}
110126
}
111127

112-
@Override
113-
public String getCommandName() {
114-
return COMMAND_RESPONSE_NAME;
115-
}
116-
117128
@Override
118129
public long getEntityOwnerId() {
119130
return CallContext.current().getCallingAccount().getId();

api/src/main/java/org/apache/cloudstack/api/command/user/dns/DeleteDnsRecordCmd.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.cloudstack.api.command.user.dns;
219

320
import org.apache.cloudstack.api.APICommand;
@@ -16,7 +33,8 @@
1633
import com.cloud.utils.EnumUtils;
1734

1835
@APICommand(name = "deleteDnsRecord", description = "Deletes a DNS record from the external provider",
19-
responseObject = SuccessResponse.class)
36+
responseObject = SuccessResponse.class, requestHasSensitiveInfo = false,
37+
responseHasSensitiveInfo = false, since = "4.23.0")
2038
public class DeleteDnsRecordCmd extends BaseAsyncCmd {
2139

2240
@Parameter(name = ApiConstants.DNS_ZONE_ID, type = CommandType.UUID, entityType = DnsZoneResponse.class,

api/src/main/java/org/apache/cloudstack/api/command/user/dns/DeleteDnsServerCmd.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.cloudstack.api.command.user.dns;
219

320
import org.apache.cloudstack.api.APICommand;
@@ -14,10 +31,9 @@
1431
import com.cloud.user.Account;
1532

1633
@APICommand(name = "deleteDnsServer", description = "Removes a DNS server integration",
17-
responseObject = SuccessResponse.class,
18-
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
34+
responseObject = SuccessResponse.class, requestHasSensitiveInfo = false,
35+
responseHasSensitiveInfo = false, since = "4.23.0")
1936
public class DeleteDnsServerCmd extends BaseAsyncCmd {
20-
private static final String COMMAND_RESPONSE_NAME = "deletednsserverresponse";
2137

2238
/////////////////////////////////////////////////////
2339
//////////////// API Parameters /////////////////////
@@ -54,11 +70,6 @@ public void execute() {
5470
}
5571
}
5672

57-
@Override
58-
public String getCommandName() {
59-
return COMMAND_RESPONSE_NAME;
60-
}
61-
6273
@Override
6374
public long getEntityOwnerId() {
6475
// Look up the server to find its owner.

api/src/main/java/org/apache/cloudstack/api/command/user/dns/DeleteDnsZoneCmd.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.cloudstack.api.command.user.dns;
219

320
import org.apache.cloudstack.api.APICommand;
@@ -14,10 +31,9 @@
1431
import com.cloud.user.Account;
1532

1633
@APICommand(name = "deleteDnsZone", description = "Removes a DNS Zone from CloudStack and the external provider",
17-
responseObject = SuccessResponse.class,
18-
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
34+
responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
35+
since = "4.23.0")
1936
public class DeleteDnsZoneCmd extends BaseAsyncCmd {
20-
private static final String COMMAND_RESPONSE_NAME = "deletednszoneresponse";
2137

2238
/////////////////////////////////////////////////////
2339
//////////////// API Parameters /////////////////////
@@ -53,11 +69,6 @@ public void execute() {
5369
}
5470
}
5571

56-
@Override
57-
public String getCommandName() {
58-
return COMMAND_RESPONSE_NAME;
59-
}
60-
6172
@Override
6273
public long getEntityOwnerId() {
6374
// Look up the Zone to find the Account Owner

api/src/main/java/org/apache/cloudstack/api/command/user/dns/DisassociateDnsZoneFromNetworkCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import com.cloud.user.Account;
3535

3636
@APICommand(name = "disassociateDnsZoneFromNetwork", description = "Removes the association between a DNS Zone and a Network",
37-
responseObject = SuccessResponse.class)
37+
responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.23.0")
3838
public class DisassociateDnsZoneFromNetworkCmd extends BaseCmd {
3939

4040
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DnsZoneNetworkMapResponse.class,

0 commit comments

Comments
 (0)