Skip to content

Commit

Permalink
First sample generated methods
Browse files Browse the repository at this point in the history
Everything in the body of BigQueryClient.DatasetLabels.cs after the first line (comment) is autogenerated.

The remaining work for these features will be:

- Implementation in BigQueryDatasetImpl
- Options test
- Snippets
- Methods in BigQueryDataset.cs (we may improve the generator to do these later...)
- Integration tests
  • Loading branch information
jskeet committed Aug 10, 2017
1 parent e96c43b commit 00a70fa
Show file tree
Hide file tree
Showing 7 changed files with 567 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Method Name="ClearDatasetLabels"
TargetType="Dataset"
ReturnType="IDictionary&lt;string, string&gt;">
<Options Type="ModifyLabelsOptions" />

<Comments>
<summary>
Clears all labels on {target}.
</summary>
<returns>A dictionary with the labels on the dataset before they were cleared.</returns>
</Comments>

</Method>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Method Name="ModifyDatasetLabels"
TargetType="Dataset"
ReturnType="IDictionary&lt;string, string&gt;">
<Options Type="ModifyLabelsOptions" />

<AdditionalParameters>
<Parameter Name="labels" Type="IDictionary&lt;string, string&gt;" Comment="The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal)." />
</AdditionalParameters>

<Comments>
<summary>
Sets or removes one or more labels on {target}.
</summary>
<remarks>
Each entry in <paramref name="labels"/> is treated as a label to set or remove. If the value is null,
it will be removed from the bucket; otherwise, it will be set/added. Labels which do not have an entry
in the dictionary will be ignored.
</remarks>
<returns>
A dictionary with the same keys as <paramref name="labels"/>, and values indicating the corresponding label value
before this operation completed. Labels which weren't present on the bucket before the modification have corresponding
null values in the returned dictionary.
</returns>
</Comments>

</Method>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Method Name="RemoveDatasetLabel"
TargetType="Dataset"
ReturnType="string">
<Options Type="ModifyLabelsOptions" />

<AdditionalParameters>
<Parameter Name="labelName" Type="string" Comment="The name of the label. Must not be null." />
</AdditionalParameters>

<Comments>
<summary>
Removes a label from a bucket, if it previously existed. It is not an error to
attempt to remove a label that doesn't already exist.
</summary>
<returns>The previous value of the label, or <c>null</c> if the label was not previously set.</returns>
</Comments>

</Method>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Method Name="SetDatasetLabel"
TargetType="Dataset"
ReturnType="string">
<Options Type="ModifyLabelsOptions" />

<AdditionalParameters>
<Parameter Name="labelName" Type="string" Comment="The name of the label. Must not be null." />
<Parameter Name="labelValue" Type="string" Comment="The new value of the label. Must not be null." />
</AdditionalParameters>

<Comments>
<summary>
Sets the value for a single label on a dataset. The label will be added if it does
not exist, or updated if it already exists.
</summary>
<remarks>
<para>
The dataset is first fetched to retrieve the current values, then a patch call is made.
</para>
</remarks>
<returns>The previous value of the label, or <c>null</c> if the label was not previously set.</returns>
</Comments>

</Method>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

declare -r CLIENT=../Google.Cloud.BigQuery.V2/BigQueryClient
dotnet run -- Methods/SetDatasetLabel.xml $CLIENT.DatasetLabels.cs
dotnet run -- Methods/RemoveDatasetLabel.xml $CLIENT.DatasetLabels.cs
dotnet run -- Methods/ClearDatasetLabels.xml $CLIENT.DatasetLabels.cs
dotnet run -- Methods/ModifyDatasetLabels.xml $CLIENT.DatasetLabels.cs
Loading

0 comments on commit 00a70fa

Please sign in to comment.