forked from googleapis/gapic-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SampleGen: default calling forms (googleapis#2713)
When: ```yaml - samples: standalone: - region_tag: some_tag # unspecified calling forms value_sets: a_value_set, b_value_set ``` Default calling forms are used. Also use region tags as file names when there is only one sample that has this region tag.
- Loading branch information
1 parent
5addb73
commit 0db3a51
Showing
26 changed files
with
1,418 additions
and
510 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
src/main/java/com/google/api/codegen/config/SampleConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* Copyright 2019 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.api.codegen.config; | ||
|
||
import com.google.api.codegen.SampleValueSet; | ||
import com.google.api.codegen.viewmodel.CallingForm; | ||
import com.google.auto.value.AutoValue; | ||
|
||
/** SampleConfig represents configurations of a sample. */ | ||
@AutoValue | ||
public abstract class SampleConfig { | ||
|
||
public abstract String regionTag(); | ||
|
||
public abstract CallingForm callingForm(); | ||
|
||
public abstract SampleValueSet valueSet(); | ||
|
||
public abstract SampleSpec.SampleType type(); | ||
|
||
public static SampleConfig create( | ||
String regionTag, | ||
CallingForm callingForm, | ||
SampleValueSet valueSet, | ||
SampleSpec.SampleType type) { | ||
return newBuilder() | ||
.regionTag(regionTag) | ||
.callingForm(callingForm) | ||
.valueSet(valueSet) | ||
.type(type) | ||
.build(); | ||
} | ||
|
||
public static Builder newBuilder() { | ||
return new AutoValue_SampleConfig.Builder(); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
|
||
public abstract Builder regionTag(String val); | ||
|
||
public abstract Builder callingForm(CallingForm val); | ||
|
||
public abstract Builder valueSet(SampleValueSet val); | ||
|
||
public abstract Builder type(SampleSpec.SampleType val); | ||
|
||
public abstract SampleConfig build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.