|
| 1 | +/* |
| 2 | + * Copyright 2015 Google Inc. All Rights Reserved. |
| 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 com.google.gcloud.resourcemanager; |
| 18 | + |
| 19 | +import com.google.common.collect.ImmutableSet; |
| 20 | +import com.google.gcloud.ServiceOptions; |
| 21 | +import com.google.gcloud.spi.ResourceManagerRpc; |
| 22 | +import com.google.gcloud.spi.ResourceManagerRpcFactory; |
| 23 | + |
| 24 | +import java.util.Set; |
| 25 | + |
| 26 | +public class ResourceManagerOptions |
| 27 | + extends ServiceOptions<ResourceManager, ResourceManagerRpc, ResourceManagerOptions> { |
| 28 | + |
| 29 | + private static final long serialVersionUID = 538303101192527452L; |
| 30 | + private static final String GCRM_SCOPE = "https://www.googleapis.com/auth/cloud-platform"; |
| 31 | + private static final Set<String> SCOPES = ImmutableSet.of(GCRM_SCOPE); |
| 32 | + |
| 33 | + public static class DefaultResourceManagerFactory implements ResourceManagerFactory { |
| 34 | + private static final ResourceManagerFactory INSTANCE = new DefaultResourceManagerFactory(); |
| 35 | + |
| 36 | + @Override |
| 37 | + public ResourceManager create(ResourceManagerOptions options) { |
| 38 | + // return new ResourceManagerImpl(options); |
| 39 | + return null; // TODO(ajaykannan): Fix me! |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + public static class DefaultResourceManagerRpcFactory implements ResourceManagerRpcFactory { |
| 44 | + private static final ResourceManagerRpcFactory INSTANCE = |
| 45 | + new DefaultResourceManagerRpcFactory(); |
| 46 | + |
| 47 | + @Override |
| 48 | + public ResourceManagerRpc create(ResourceManagerOptions options) { |
| 49 | + // return new DefaultResourceManagerRpc(options); |
| 50 | + return null; // TODO(ajaykannan): Fix me! |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + public static class Builder extends ServiceOptions.Builder<ResourceManager, ResourceManagerRpc, |
| 55 | + ResourceManagerOptions, Builder> { |
| 56 | + |
| 57 | + private Builder() {} |
| 58 | + |
| 59 | + private Builder(ResourceManagerOptions options) { |
| 60 | + super(options); |
| 61 | + } |
| 62 | + |
| 63 | + @Override |
| 64 | + public ResourceManagerOptions build() { |
| 65 | + return new ResourceManagerOptions(this); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + private ResourceManagerOptions(Builder builder) { |
| 70 | + super(ResourceManagerFactory.class, ResourceManagerRpcFactory.class, builder); |
| 71 | + } |
| 72 | + |
| 73 | + @Override |
| 74 | + protected ResourceManagerFactory defaultServiceFactory() { |
| 75 | + return DefaultResourceManagerFactory.INSTANCE; |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + protected ResourceManagerRpcFactory defaultRpcFactory() { |
| 80 | + return DefaultResourceManagerRpcFactory.INSTANCE; |
| 81 | + } |
| 82 | + |
| 83 | + @Override |
| 84 | + protected Set<String> scopes() { |
| 85 | + return SCOPES; |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public boolean equals(Object obj) { |
| 90 | + return obj instanceof ResourceManagerOptions && baseEquals((ResourceManagerOptions) obj); |
| 91 | + } |
| 92 | + |
| 93 | + @Override |
| 94 | + public Builder toBuilder() { |
| 95 | + return new Builder(this); |
| 96 | + } |
| 97 | + |
| 98 | + public static Builder builder() { |
| 99 | + return new Builder(); |
| 100 | + } |
| 101 | +} |
0 commit comments