|
18 | 18 |
|
19 | 19 | import com.google.common.base.Joiner; |
20 | 20 | import com.google.common.collect.Sets; |
| 21 | +import com.google.gcloud.Page; |
21 | 22 | import com.google.gcloud.Service; |
22 | 23 | import com.google.gcloud.spi.DnsRpc; |
23 | 24 |
|
24 | 25 | import java.io.Serializable; |
| 26 | +import java.math.BigInteger; |
25 | 27 | import java.util.Set; |
26 | 28 |
|
27 | | -import static com.google.gcloud.dns.Dns.ZoneField.selector; |
28 | | - |
29 | 29 | /** |
30 | 30 | * An interface for the Google Cloud DNS service. |
31 | 31 | * |
@@ -285,7 +285,7 @@ class ZoneListOption extends AbstractOption implements Serializable { |
285 | 285 | */ |
286 | 286 | public static ZoneListOption fields(ZoneField... fields) { |
287 | 287 | StringBuilder builder = new StringBuilder(); |
288 | | - builder.append("managedZones(").append(selector(fields)).append(')'); |
| 288 | + builder.append("managedZones(").append(ZoneField.selector(fields)).append(')'); |
289 | 289 | return new ZoneListOption(DnsRpc.Option.FIELDS, builder.toString()); |
290 | 290 | } |
291 | 291 |
|
@@ -420,5 +420,191 @@ public static ChangeRequestListOption sortOrder(SortingOrder order) { |
420 | 420 | } |
421 | 421 | } |
422 | 422 |
|
423 | | - // TODO(mderka) Add methods. Created issue #596. |
| 423 | + /** |
| 424 | + * Creates a new zone. |
| 425 | + * |
| 426 | + * @return ZoneInfo object representing the new zone's metadata. In addition to the name, dns name |
| 427 | + * and description (supplied by the user within the {@code zoneInfo} parameter, the returned |
| 428 | + * object will include the following read-only fields supplied by the server: creation time, id, |
| 429 | + * and list of name servers. |
| 430 | + * @throws DnsException upon failure |
| 431 | + * @see <a href="https://cloud.google.com/dns/api/v1/managedZones/create">Cloud DNS Managed Zones: |
| 432 | + * create</a> |
| 433 | + */ |
| 434 | + ZoneInfo create(ZoneInfo zoneInfo); |
| 435 | + |
| 436 | + /** |
| 437 | + * Retrieves the zone by the specified zone name. Returns {@code null} is the zone is not found. |
| 438 | + * The returned fields can be optionally restricted by specifying {@code ZoneFieldOptions}. |
| 439 | + * |
| 440 | + * @throws DnsException upon failure |
| 441 | + * @see <a href="https://cloud.google.com/dns/api/v1/managedZones/get">Cloud DNS Managed Zones: |
| 442 | + * get</a> |
| 443 | + */ |
| 444 | + ZoneInfo getZone(String zoneName, ZoneOption... options); |
| 445 | + |
| 446 | + /** |
| 447 | + * Retrieves the zone by the specified zone name. Returns {@code null} is the zone is not found. |
| 448 | + * The returned fields can be optionally restricted by specifying {@code ZoneFieldOptions}. |
| 449 | + * |
| 450 | + * @throws DnsException upon failure |
| 451 | + * @see <a href="https://cloud.google.com/dns/api/v1/managedZones/get">Cloud DNS Managed Zones: |
| 452 | + * get</a> |
| 453 | + */ |
| 454 | + ZoneInfo getZone(BigInteger zoneId, ZoneOption... options); |
| 455 | + |
| 456 | + /** |
| 457 | + * Lists the zoned inside the project. |
| 458 | + * |
| 459 | + * <p>This method returns zone in an unspecified order. New zones do not necessarily appear at the |
| 460 | + * end of the list. Use {@link ZoneListOption} to restrict the listing to a domain name, set page |
| 461 | + * size, and set page tokens. |
| 462 | + * |
| 463 | + * @return {@code Page<Zone>}, a page of zones |
| 464 | + * @throws DnsException upon failure |
| 465 | + * @see <a href="https://cloud.google.com/dns/api/v1/managedZones/list">Cloud DNS Managed Zones: |
| 466 | + * list</a> |
| 467 | + */ |
| 468 | + Page<Zone> listZones(ZoneListOption... options); |
| 469 | + |
| 470 | + /** |
| 471 | + * Deletes an existing zone identified by name. Returns true if the zone was successfully deleted |
| 472 | + * and false otherwise. |
| 473 | + * |
| 474 | + * @return {@code true} if zone was found and deleted and false otherwise |
| 475 | + * @throws DnsException upon failure |
| 476 | + * @see <a href="https://cloud.google.com/dns/api/v1/managedZones/delete">Cloud DNS Managed Zones: |
| 477 | + * delete</a> |
| 478 | + */ |
| 479 | + boolean delete(String zoneName); // delete does not admit any options |
| 480 | + |
| 481 | + /** |
| 482 | + * Deletes an existing zone identified by id. Returns true if the zone was successfully deleted |
| 483 | + * and false otherwise. |
| 484 | + * |
| 485 | + * @return {@code true} if zone was found and deleted and false otherwise |
| 486 | + * @throws DnsException upon failure |
| 487 | + * @see <a href="https://cloud.google.com/dns/api/v1/managedZones/delete">Cloud DNS Managed Zones: |
| 488 | + * delete</a> |
| 489 | + */ |
| 490 | + boolean delete(BigInteger zoneId); // delete does not admit any options |
| 491 | + |
| 492 | + /** |
| 493 | + * Lists the DNS records in the zone identified by name. |
| 494 | + * |
| 495 | + * <p>The fields to be returned, page size and page tokens can be specified using {@code |
| 496 | + * DnsRecordOptions}. Returns null if the zone cannot be found. |
| 497 | + * |
| 498 | + * @throws DnsException upon failure |
| 499 | + * @see <a href="https://cloud.google.com/dns/api/v1/resourceRecordSets/list">Cloud DNS |
| 500 | + * ResourceRecordSets: list</a> |
| 501 | + */ |
| 502 | + Page<DnsRecord> listDnsRecords(String zoneName, DnsRecordListOption... options); |
| 503 | + |
| 504 | + /** |
| 505 | + * Lists the DNS records in the zone identified by ID. |
| 506 | + * |
| 507 | + * <p>The fields to be returned, page size and page tokens can be specified using {@code |
| 508 | + * DnsRecordOptions}. Returns null if the zone cannot be found. |
| 509 | + * |
| 510 | + * @throws DnsException upon failure |
| 511 | + * @see <a href="https://cloud.google.com/dns/api/v1/resourceRecordSets/list">Cloud DNS |
| 512 | + * ResourceRecordSets: list</a> |
| 513 | + */ |
| 514 | + Page<DnsRecord> listDnsRecords(BigInteger zoneId, DnsRecordListOption... options); |
| 515 | + |
| 516 | + /** |
| 517 | + * Retrieves the metadata about the current project. The returned fields can be optionally |
| 518 | + * restricted by specifying {@code ProjectOptions}. |
| 519 | + * |
| 520 | + * @throws DnsException upon failure |
| 521 | + * @see <a href="https://cloud.google.com/dns/api/v1/projects/get">Cloud DNS Projects: get</a> |
| 522 | + */ |
| 523 | + ProjectInfo getProjectInfo(ProjectGetOption... fields); |
| 524 | + |
| 525 | + /** |
| 526 | + * Returns the current project id. |
| 527 | + */ |
| 528 | + String getProjectId(); |
| 529 | + |
| 530 | + /** |
| 531 | + * Returns the current project number. |
| 532 | + */ |
| 533 | + BigInteger getProjectNumber(); |
| 534 | + |
| 535 | + /** |
| 536 | + * Submits a change requests for applying to the zone identified by ID to the service. The |
| 537 | + * returned object contains the following read-only fields supplied by the server: id, start time |
| 538 | + * and status. time, id, and list of name servers. The returned fields can be modified by {@code |
| 539 | + * ChangeRequestFieldOptions}. Returns null if the zone is not found. |
| 540 | + * |
| 541 | + * @return ChangeRequest object representing the new change request or null if zone is not found |
| 542 | + * @throws DnsException upon failure |
| 543 | + * @see <a href="https://cloud.google.com/dns/api/v1/changes/create">Cloud DNS Changes: create</a> |
| 544 | + */ |
| 545 | + ChangeRequest applyChangeRequest(ChangeRequest changeRequest, BigInteger zoneId, |
| 546 | + ChangeRequestOption... options); |
| 547 | + |
| 548 | + /** |
| 549 | + * Submits a change requests for applying to the zone identified by name to the service. The |
| 550 | + * returned object contains the following read-only fields supplied by the server: id, start time |
| 551 | + * and status. time, id, and list of name servers. The returned fields can be modified by {@code |
| 552 | + * ChangeRequestFieldOptions}. Returns null if the zone is not found. |
| 553 | + * |
| 554 | + * @return ChangeRequest object representing the new change request or null if zone is not found |
| 555 | + * @throws DnsException upon failure |
| 556 | + * @see <a href="https://cloud.google.com/dns/api/v1/changes/create">Cloud DNS Changes: create</a> |
| 557 | + */ |
| 558 | + ChangeRequest applyChangeRequest(ChangeRequest changeRequest, String zoneName, |
| 559 | + ChangeRequestOption... options); |
| 560 | + |
| 561 | + /** |
| 562 | + * Retrieves updated information about a change request previously submitted for a zone identified |
| 563 | + * by ID. Returns null if the zone or request cannot be found. |
| 564 | + * |
| 565 | + * <p>The fields to be returned using {@code ChangeRequestFieldOptions}. |
| 566 | + * |
| 567 | + * @throws DnsException upon failure |
| 568 | + * @see <a href="https://cloud.google.com/dns/api/v1/changes/get">Cloud DNS Chages: get</a> |
| 569 | + */ |
| 570 | + ChangeRequest getChangeRequest(ChangeRequest changeRequest, BigInteger zoneId, |
| 571 | + ChangeRequestOption... options); |
| 572 | + |
| 573 | + /** |
| 574 | + * Retrieves updated information about a change request previously submitted for a zone identified |
| 575 | + * by name. Returns null if the zone or request cannot be found. |
| 576 | + * |
| 577 | + * <p>The fields to be returned using {@code ChangeRequestFieldOptions}. |
| 578 | + * |
| 579 | + * @throws DnsException upon failure |
| 580 | + * @see <a href="https://cloud.google.com/dns/api/v1/changes/get">Cloud DNS Chages: get</a> |
| 581 | + */ |
| 582 | + ChangeRequest getChangeRequest(ChangeRequest changeRequest, String zoneName, |
| 583 | + ChangeRequestOption... options); |
| 584 | + |
| 585 | + /** |
| 586 | + * Lists the change requests for the zone identified by ID that were submitted to the service. |
| 587 | + * |
| 588 | + * <p>The sorting key for changes, fields to be returned, page and page tokens can be specified |
| 589 | + * using {@code ChangeRequestListOptions}. Note that the only sorting key currently supported is |
| 590 | + * the timestamp of submitting the change request to the service. |
| 591 | + * |
| 592 | + * @return {@code Page<ChangeRequest>}, a page of change requests |
| 593 | + * @throws DnsException upon failure |
| 594 | + * @see <a href="https://cloud.google.com/dns/api/v1/changes/list">Cloud DNS Chages: list</a> |
| 595 | + */ |
| 596 | + Page<ChangeRequest> listChangeRequests(BigInteger zoneId, ChangeRequestListOption... options); |
| 597 | + |
| 598 | + /** |
| 599 | + * Lists the change requests for the zone identified by name that were submitted to the service. |
| 600 | + * |
| 601 | + * <p>The sorting key for changes, fields to be returned, page and page tokens can be specified |
| 602 | + * using {@code ChangeRequestListOptions}. Note that the only sorting key currently supported is |
| 603 | + * the timestamp of submitting the change request to the service. |
| 604 | + * |
| 605 | + * @return {@code Page<ChangeRequest>}, a page of change requests |
| 606 | + * @throws DnsException upon failure |
| 607 | + * @see <a href="https://cloud.google.com/dns/api/v1/changes/list">Cloud DNS Chages: list</a> |
| 608 | + */ |
| 609 | + Page<ChangeRequest> listChangeRequests(String zoneName, ChangeRequestListOption... options); |
424 | 610 | } |
0 commit comments