@Test public void testListSelectorWithExtraFields() { String selector = Helper.listSelector(CONTAINER, REQUIRED_FIELDS, new FieldSelector[] {FIELD3}, "field4"); assertTrue(selector.startsWith("nextPageToken,container(")); assertTrue(selector.contains("field1")); assertTrue(selector.contains("field2")); assertTrue(selector.contains("field3")); assertTrue(selector.contains("field4")); assertTrue(selector.endsWith(")")); assertEquals(52, selector.length()); }
@Test public void testListSelector() { String selector = Helper.listSelector(CONTAINER, REQUIRED_FIELDS, FIELD3); assertTrue(selector.startsWith("nextPageToken,container(")); assertTrue(selector.contains("field1")); assertTrue(selector.contains("field2")); assertTrue(selector.contains("field3")); assertTrue(selector.endsWith(")")); assertEquals(45, selector.length()); }
/** * Returns an option to specify which fields of{@link ChangeRequest} should be returned by the * service. * * <p>If this option is not provided all change request fields are returned. {@code * ChangeRequestOption.fields} can be used to specify only the fields of interest. The ID of the * change request is always returned, even if not specified. {@link ChangeRequestField} provides * a list of fields that can be used. */ public static ChangeRequestListOption fields(ChangeRequestField... fields) { return new ChangeRequestListOption( DnsRpc.Option.FIELDS, Helper.listSelector("changes", ChangeRequestField.REQUIRED_FIELDS, fields)); }
/** * Returns an option to specify the job's fields to be returned by the RPC call. If this option * is not provided all job's fields are returned. {@code JobOption.fields()} can be used to * specify only the fields of interest. {@link Job#getJobId()}, {@link JobStatus#getState()}, * {@link JobStatus#getError()} as well as type-specific configuration (e.g. {@link * QueryJobConfiguration#getQuery()} for Query Jobs) are always returned, even if not specified. * {@link JobField#SELF_LINK} and {@link JobField#ETAG} can not be selected when listing jobs. */ public static JobListOption fields(JobField... fields) { return new JobListOption( BigQueryRpc.Option.FIELDS, Helper.listSelector("jobs", JobField.REQUIRED_FIELDS, fields, "state", "errorResult")); } }
/** * Returns a composite selector given a number of resource fields and a container name. This * method also takes an {@code extraResourceFields} parameter to specify some extra resource * fields as strings. The string selector returned by this method can be used for field * selection in API calls that return a list of resources. This method is not supposed to be * used directly by users. */ public static String listSelector( String containerName, List<? extends FieldSelector> required, FieldSelector[] others, String... extraResourceFields) { return listSelector(EMPTY_FIELDS, containerName, required, others, extraResourceFields); }
/** * Returns an option to specify the record set's fields to be returned by the RPC call. * * <p>If this option is not provided all record fields are returned. {@code * RecordSetField.fields} can be used to specify only the fields of interest. The name of the * record set in always returned, even if not specified. {@link RecordSetField} provides a list * of fields that can be used. */ public static RecordSetListOption fields(RecordSetField... fields) { return new RecordSetListOption( DnsRpc.Option.FIELDS, Helper.listSelector("rrsets", RecordSetField.REQUIRED_FIELDS, fields)); }
/** * Returns an option to specify the bucket's fields to be returned by the RPC call. If this * option is not provided all bucket's fields are returned. {@code BucketListOption.fields}) can * be used to specify only the fields of interest. Bucket name is always returned, even if not * specified. */ public static BucketListOption fields(BucketField... fields) { return new BucketListOption( StorageRpc.Option.FIELDS, Helper.listSelector("items", BucketField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the subnetwork's fields to be returned by the RPC call. If this * option is not provided, all subnetwork's fields are returned. {@code * SubnetworListkOption.fields} can be used to specify only the fields of interest. {@link * Subnetwork#getSubnetworkId()} is always returned, even if not specified. */ public static SubnetworkListOption fields(SubnetworkField... fields) { return new SubnetworkListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", SubnetworkField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the operation's fields to be returned by the RPC call. If this * option is not provided, all operation's fields are returned. {@code * OperationListOption.fields} can be used to specify only the fields of interest. {@link * Operation#getOperationId()} is always returned, even if not specified. */ public static OperationListOption fields(OperationField... fields) { return new OperationListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", OperationField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the blob's fields to be returned by the RPC call. If this option * is not provided all blob's fields are returned. {@code BlobListOption.fields}) can be used to * specify only the fields of interest. Blob name and bucket are always returned, even if not * specified. */ public static BlobListOption fields(BlobField... fields) { return new BlobListOption( StorageRpc.Option.FIELDS, Helper.listSelector(TOP_LEVEL_FIELDS, "items", BlobField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the zones's fields to be returned by the RPC call. * * <p>If this option is not provided all zone fields are returned. {@code ZoneOption.fields} can * be used to specify only the fields of interest. Zone ID is always returned, even if not * specified. {@link ZoneField} provides a list of fields that can be used. */ public static ZoneListOption fields(ZoneField... fields) { return new ZoneListOption( DnsRpc.Option.FIELDS, Helper.listSelector("managedZones", ZoneField.REQUIRED_FIELDS, fields)); }
/** * Returns an option to specify the region's fields to be returned by the RPC call. If this * option is not provided, all region's fields are returned. {@code RegionListOption.fields} can * be used to specify only the fields of interest. {@link Region#getRegionId()} is always * returned, even if not specified. */ public static RegionListOption fields(RegionField... fields) { return new RegionListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", RegionField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the address' fields to be returned by the RPC call. If this * option is not provided, all address' fields are returned. {@code AddressListOption.fields} * can be used to specify only the fields of interest. {@link Address#getAddressId()} is always * returned, even if not specified. */ public static AddressListOption fields(AddressField... fields) { return new AddressListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", AddressField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the zone's fields to be returned by the RPC call. If this option * is not provided, all zone's fields are returned. {@code ZoneListOption.fields} can be used to * specify only the fields of interest. {@link Zone#getZoneId()} is always returned, even if not * specified. */ public static ZoneListOption fields(ZoneField... fields) { return new ZoneListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", ZoneField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the machine type's fields to be returned by the RPC call. If * this option is not provided, all machine type's fields are returned. {@code * MachineTypeListOption.fields} can be used to specify only the fields of interest. {@link * MachineType#getMachineTypeId()} is always returned, even if not specified. */ public static MachineTypeListOption fields(MachineTypeField... fields) { return new MachineTypeListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", MachineTypeField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the instance's fields to be returned by the RPC call. If this * option is not provided, all instance's fields are returned. {@code InstanceListOption.fields} * can be used to specify only the fields of interest. {@link Instance#getInstanceId()} is * always returned, even if not specified. */ public static InstanceListOption fields(InstanceField... fields) { return new InstanceListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", InstanceField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the network's fields to be returned by the RPC call. If this * option is not provided, all network's fields are returned. {@code NetworkListOption.fields} * can be used to specify only the fields of interest. {@link Network#getNetworkId()} and {@link * Network#getConfiguration()} are always returned, even if not specified. */ public static NetworkListOption fields(NetworkField... fields) { return new NetworkListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", NetworkField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the image's fields to be returned by the RPC call. If this * option is not provided, all image's fields are returned. {@code ImageListOption.fields} can * be used to specify only the fields of interest. {@link Image#getImageId()} and {@link * Image#getConfiguration()} are always returned, even if not specified. */ public static ImageListOption fields(ImageField... fields) { return new ImageListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", ImageField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the snapshot's fields to be returned by the RPC call. If this * option is not provided, all the snapshot's fields are returned. {@code * SnapshotListOption.fields} can be used to specify only the fields of interest. {@link * Snapshot#getSnapshotId()} is always returned, even if not specified. */ public static SnapshotListOption fields(SnapshotField... fields) { return new SnapshotListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", SnapshotField.REQUIRED_FIELDS, fields)); } }
/** * Returns an option to specify the disk type's fields to be returned by the RPC call. If this * option is not provided, all disk type's fields are returned. {@code * DiskTypeListOption.fields} can be used to specify only the fields of interest. {@link * DiskType#getDiskTypeId()} is always returned, even if not specified. */ public static DiskTypeListOption fields(DiskTypeField... fields) { return new DiskTypeListOption( ComputeRpc.Option.FIELDS, Helper.listSelector("items", DiskTypeField.REQUIRED_FIELDS, fields)); } }