gpt4 book ai didi

com.google.cloud.compute.v1.ZoneSettings类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:30:19 27 4
gpt4 key购买 nike

本文整理了Java中com.google.cloud.compute.v1.ZoneSettings类的一些代码示例,展示了ZoneSettings类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneSettings类的具体详情如下:
包路径:com.google.cloud.compute.v1.ZoneSettings
类名称:ZoneSettings

ZoneSettings介绍

[英]Settings class to configure an instance of ZoneClient.

The default instance has everything set to sensible defaults:

  • The default service address (https://www.googleapis.com/compute/v1/projects/) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object. For example, to set the total timeout of getZone to 30 seconds:

ZoneSettings.Builder zoneSettingsBuilder = 
ZoneSettings.newBuilder(); 
zoneSettingsBuilder.getZoneSettings().getRetrySettings().toBuilder() 
.setTotalTimeout(Duration.ofSeconds(30)); 
ZoneSettings zoneSettings = zoneSettingsBuilder.build();

[中]设置类来配置ZoneClient的实例。
默认实例将所有内容都设置为合理的默认值:
*默认的服务地址(https://www.googleapis.com/compute/v1/projects/)并使用默认端口(443)。
*通过应用程序默认凭据自动获取凭据。
*重试配置为幂等方法,但不配置为非幂等方法。
这个类的构建器是递归的,所以包含的类本身就是构建器。调用build()时,将调用构建器树来创建完整的设置对象。例如,要将getZone的总超时设置为30秒:

ZoneSettings.Builder zoneSettingsBuilder = 
ZoneSettings.newBuilder(); 
zoneSettingsBuilder.getZoneSettings().getRetrySettings().toBuilder() 
.setTotalTimeout(Duration.ofSeconds(30)); 
ZoneSettings zoneSettings = zoneSettingsBuilder.build();

代码示例

代码示例来源:origin: googleapis/google-cloud-java

@Override
 public ZoneSettings build() throws IOException {
  return new ZoneSettings(this);
 }
}

代码示例来源:origin: googleapis/google-cloud-java

/**
 * Constructs an instance of ZoneClient, using the given settings. This is protected so that it is
 * easy to make a subclass, but otherwise, the static factory methods should be preferred.
 */
protected ZoneClient(ZoneSettings settings) throws IOException {
 this.settings = settings;
 this.stub = ((ZoneStubSettings) settings.getStubSettings()).createStub();
}

代码示例来源:origin: googleapis/google-cloud-java

@BeforeClass
public static void setUp() throws IOException {
 clientSettings =
   ZoneSettings.newBuilder()
     .setTransportChannelProvider(
       ZoneSettings.defaultHttpJsonTransportProviderBuilder()
         .setHttpTransport(mockService)
         .build())
     .setCredentialsProvider(NoCredentialsProvider.create())
     .build();
 client = ZoneClient.create(clientSettings);
}

代码示例来源:origin: googleapis/google-cloud-java

/** Constructs an instance of ZoneClient with default settings. */
public static final ZoneClient create() throws IOException {
 return create(ZoneSettings.newBuilder().build());
}

代码示例来源:origin: googleapis/google-cloud-java

/** Returns the object with the settings used for calls to listZones. */
public PagedCallSettings<ListZonesHttpRequest, ZoneList, ListZonesPagedResponse>
  listZonesSettings() {
 return ((ZoneStubSettings) getStubSettings()).listZonesSettings();
}

代码示例来源:origin: googleapis/google-cloud-java

protected Builder(ZoneSettings settings) {
 super(settings.getStubSettings().toBuilder());
}

代码示例来源:origin: googleapis/google-cloud-java

/** Returns the object with the settings used for calls to getZone. */
public UnaryCallSettings<GetZoneHttpRequest, Zone> getZoneSettings() {
 return ((ZoneStubSettings) getStubSettings()).getZoneSettings();
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com