Skip to content

Commit e17bedb

Browse files
committed
Implemented DnsOptions up to two unavailable classes.
1 parent 762483b commit e17bedb

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.google.gcloud.dns;
1818

19-
import com.google.common.collect.Sets;
19+
import com.google.common.collect.ImmutableSet;
2020
import com.google.gcloud.ServiceOptions;
2121
import com.google.gcloud.spi.DnsRpc;
2222
import com.google.gcloud.spi.DnsRpcFactory;
@@ -26,16 +26,28 @@
2626
public class DnsOptions
2727
extends ServiceOptions<Dns, DnsRpc, DnsOptions> {
2828

29-
private static final long serialVersionUID = -5311219368450107146L;
30-
31-
// TODO(mderka) Finish implementation. Created issue #595.
29+
private static final long serialVersionUID = -519128051411747771L;
30+
private static final String GC_DNS_RW = "https://www.googleapis.com/auth/ndev.clouddns.readwrite";
31+
private static final String GC_DNS_R = "https://www.googleapis.com/auth/ndev.clouddns.readonly";
32+
private static final Set<String> SCOPES = ImmutableSet.of(GC_DNS_RW, GC_DNS_R);
3233

3334
public static class DefaultDnsFactory implements DnsFactory {
3435
private static final DnsFactory INSTANCE = new DefaultDnsFactory();
3536

3637
@Override
3738
public Dns create(DnsOptions options) {
38-
// TODO(mderka) Implement. Created issue #595.
39+
// TODO(mderka) Implement when DnsImpl is available. Created issue #595.
40+
return null;
41+
}
42+
}
43+
44+
public static class DefaultDnsRpcFactory implements DnsRpcFactory {
45+
46+
private static final DnsRpcFactory INSTANCE = new DefaultDnsRpcFactory();
47+
48+
@Override
49+
public DnsRpc create(DnsOptions options) {
50+
// TODO(mderka) Implement when DefaultDnsRpc is available. Created issue #595.
3951
return null;
4052
}
4153
}
@@ -60,22 +72,24 @@ private DnsOptions(Builder builder) {
6072
super(DnsFactory.class, DnsRpcFactory.class, builder);
6173
}
6274

75+
@SuppressWarnings("unchecked")
6376
@Override
6477
protected DnsFactory defaultServiceFactory() {
6578
return DefaultDnsFactory.INSTANCE;
6679
}
6780

81+
@SuppressWarnings("unchecked")
6882
@Override
6983
protected DnsRpcFactory defaultRpcFactory() {
7084
return null;
7185
}
7286

7387
@Override
7488
protected Set<String> scopes() {
75-
// TODO(mderka) Verify.
76-
return Sets.newHashSet("ndev.clouddns.readwrite");
89+
return SCOPES;
7790
}
7891

92+
@SuppressWarnings("unchecked")
7993
@Override
8094
public Builder toBuilder() {
8195
return new Builder(this);

0 commit comments

Comments
 (0)