Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

feat: Added support for field to disable default budget alerts to IAM recipients. fix: Pub/Sub fields in AllUpdatesRule are now optional. fix: Added cloud-billing OAuth scope. #234

Merged
merged 2 commits into from Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>9.1.0</version>
<version>10.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Expand Up @@ -93,7 +93,10 @@
public class BudgetServiceStubSettings extends StubSettings<BudgetServiceStubSettings> {
/** The default scopes of the service. */
private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
ImmutableList.<String>builder().add("https://www.googleapis.com/auth/cloud-platform").build();
ImmutableList.<String>builder()
.add("https://www.googleapis.com/auth/cloud-billing")
.add("https://www.googleapis.com/auth/cloud-platform")
.build();

private final UnaryCallSettings<CreateBudgetRequest, Budget> createBudgetSettings;
private final UnaryCallSettings<UpdateBudgetRequest, Budget> updateBudgetSettings;
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -27,20 +27,20 @@ public interface AllUpdatesRuleOrBuilder
*
*
* <pre>
* Required. The name of the Cloud Pub/Sub topic where budget related messages
* will be published, in the form `projects/{project_id}/topics/{topic_id}`.
* Optional. The name of the Pub/Sub topic where budget related messages will
* be published, in the form `projects/{project_id}/topics/{topic_id}`.
* Updates are sent at regular intervals to the topic. The topic needs to be
* created before the budget is created; see
* https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
* for more details.
* Caller is expected to have
* `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
* budget, otherwise, the API call will fail with PERMISSION_DENIED. See
* https://cloud.google.com/pubsub/docs/access-control for more details on
* Pub/Sub roles and permissions.
* https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
* for more details on Pub/Sub roles and permissions.
* </pre>
*
* <code>string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* <code>string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The pubsubTopic.
*/
Expand All @@ -49,20 +49,20 @@ public interface AllUpdatesRuleOrBuilder
*
*
* <pre>
* Required. The name of the Cloud Pub/Sub topic where budget related messages
* will be published, in the form `projects/{project_id}/topics/{topic_id}`.
* Optional. The name of the Pub/Sub topic where budget related messages will
* be published, in the form `projects/{project_id}/topics/{topic_id}`.
* Updates are sent at regular intervals to the topic. The topic needs to be
* created before the budget is created; see
* https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
* for more details.
* Caller is expected to have
* `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
* budget, otherwise, the API call will fail with PERMISSION_DENIED. See
* https://cloud.google.com/pubsub/docs/access-control for more details on
* Pub/Sub roles and permissions.
* https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
* for more details on Pub/Sub roles and permissions.
* </pre>
*
* <code>string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* <code>string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for pubsubTopic.
*/
Expand All @@ -72,12 +72,12 @@ public interface AllUpdatesRuleOrBuilder
*
*
* <pre>
* Required. The schema version of the notification sent to `pubsub_topic`.
* Optional. The schema version of the notification sent to `pubsub_topic`.
* Only "1.0" is accepted. It represents the JSON schema as defined in
* https://cloud.google.com/billing/docs/how-to/budgets#notification_format
* https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
* </pre>
*
* <code>string schema_version = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* <code>string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The schemaVersion.
*/
Expand All @@ -86,12 +86,12 @@ public interface AllUpdatesRuleOrBuilder
*
*
* <pre>
* Required. The schema version of the notification sent to `pubsub_topic`.
* Optional. The schema version of the notification sent to `pubsub_topic`.
* Only "1.0" is accepted. It represents the JSON schema as defined in
* https://cloud.google.com/billing/docs/how-to/budgets#notification_format
* https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
* </pre>
*
* <code>string schema_version = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* <code>string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The bytes for schemaVersion.
*/
Expand All @@ -102,11 +102,13 @@ public interface AllUpdatesRuleOrBuilder
*
* <pre>
* Optional. Targets to send notifications to when a threshold is exceeded.
* This is in addition to default recipients who have billing account roles.
* The value is the full REST resource name of a monitoring notification
* channel with the form
* This is in addition to default recipients who have billing account IAM
* roles. The value is the full REST resource name of a monitoring
* notification channel with the form
* `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
* channels are allowed.
* channels are allowed. See
* https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
* for more details.
* </pre>
*
* <code>
Expand All @@ -121,11 +123,13 @@ public interface AllUpdatesRuleOrBuilder
*
* <pre>
* Optional. Targets to send notifications to when a threshold is exceeded.
* This is in addition to default recipients who have billing account roles.
* The value is the full REST resource name of a monitoring notification
* channel with the form
* This is in addition to default recipients who have billing account IAM
* roles. The value is the full REST resource name of a monitoring
* notification channel with the form
* `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
* channels are allowed.
* channels are allowed. See
* https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
* for more details.
* </pre>
*
* <code>
Expand All @@ -140,11 +144,13 @@ public interface AllUpdatesRuleOrBuilder
*
* <pre>
* Optional. Targets to send notifications to when a threshold is exceeded.
* This is in addition to default recipients who have billing account roles.
* The value is the full REST resource name of a monitoring notification
* channel with the form
* This is in addition to default recipients who have billing account IAM
* roles. The value is the full REST resource name of a monitoring
* notification channel with the form
* `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
* channels are allowed.
* channels are allowed. See
* https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
* for more details.
* </pre>
*
* <code>
Expand All @@ -160,11 +166,13 @@ public interface AllUpdatesRuleOrBuilder
*
* <pre>
* Optional. Targets to send notifications to when a threshold is exceeded.
* This is in addition to default recipients who have billing account roles.
* The value is the full REST resource name of a monitoring notification
* channel with the form
* This is in addition to default recipients who have billing account IAM
* roles. The value is the full REST resource name of a monitoring
* notification channel with the form
* `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
* channels are allowed.
* channels are allowed. See
* https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
* for more details.
* </pre>
*
* <code>
Expand All @@ -175,4 +183,19 @@ public interface AllUpdatesRuleOrBuilder
* @return The bytes of the monitoringNotificationChannels at the given index.
*/
com.google.protobuf.ByteString getMonitoringNotificationChannelsBytes(int index);

/**
*
*
* <pre>
* Optional. When set to true, disables default notifications sent when a
* threshold is exceeded. Recipients are those with Billing Account
* Administrators and Billing Account Users IAM roles for the target account.
* </pre>
*
* <code>bool disable_default_iam_recipients = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The disableDefaultIamRecipients.
*/
boolean getDisableDefaultIamRecipients();
}
Expand Up @@ -91,24 +91,25 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "cloud.billing.budgets.v1beta1.ThresholdR"
+ "ule.BasisB\003\340A\001\"G\n\005Basis\022\025\n\021BASIS_UNSPECI"
+ "FIED\020\000\022\021\n\rCURRENT_SPEND\020\001\022\024\n\020FORECASTED_"
+ "SPEND\020\002\"w\n\016AllUpdatesRule\022\031\n\014pubsub_topi"
+ "c\030\001 \001(\tB\003\340A\002\022\033\n\016schema_version\030\002 \001(\tB\003\340A"
+ "\002\022-\n monitoring_notification_channels\030\003 "
+ "\003(\tB\003\340A\001\"\304\003\n\006Filter\022\025\n\010projects\030\001 \003(\tB\003\340"
+ "A\001\022f\n\026credit_types_treatment\030\004 \001(\0162A.goo"
+ "gle.cloud.billing.budgets.v1beta1.Filter"
+ ".CreditTypesTreatmentB\003\340A\001\022\025\n\010services\030\003"
+ " \003(\tB\003\340A\001\022\030\n\013subaccounts\030\005 \003(\tB\003\340A\001\022M\n\006l"
+ "abels\030\006 \003(\01328.google.cloud.billing.budge"
+ "ts.v1beta1.Filter.LabelsEntryB\003\340A\001\032I\n\013La"
+ "belsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032."
+ "google.protobuf.ListValue:\0028\001\"p\n\024CreditT"
+ "ypesTreatment\022&\n\"CREDIT_TYPES_TREATMENT_"
+ "UNSPECIFIED\020\000\022\027\n\023INCLUDE_ALL_CREDITS\020\001\022\027"
+ "\n\023EXCLUDE_ALL_CREDITS\020\002By\n(com.google.cl"
+ "oud.billing.budgets.v1beta1P\001ZKgoogle.go"
+ "lang.org/genproto/googleapis/cloud/billi"
+ "ng/budgets/v1beta1;budgetsb\006proto3"
+ "SPEND\020\002\"\244\001\n\016AllUpdatesRule\022\031\n\014pubsub_top"
+ "ic\030\001 \001(\tB\003\340A\001\022\033\n\016schema_version\030\002 \001(\tB\003\340"
+ "A\001\022-\n monitoring_notification_channels\030\003"
+ " \003(\tB\003\340A\001\022+\n\036disable_default_iam_recipie"
+ "nts\030\004 \001(\010B\003\340A\001\"\304\003\n\006Filter\022\025\n\010projects\030\001 "
+ "\003(\tB\003\340A\001\022f\n\026credit_types_treatment\030\004 \001(\016"
+ "2A.google.cloud.billing.budgets.v1beta1."
+ "Filter.CreditTypesTreatmentB\003\340A\001\022\025\n\010serv"
+ "ices\030\003 \003(\tB\003\340A\001\022\030\n\013subaccounts\030\005 \003(\tB\003\340A"
+ "\001\022M\n\006labels\030\006 \003(\01328.google.cloud.billing"
+ ".budgets.v1beta1.Filter.LabelsEntryB\003\340A\001"
+ "\032I\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 "
+ "\001(\0132\032.google.protobuf.ListValue:\0028\001\"p\n\024C"
+ "reditTypesTreatment\022&\n\"CREDIT_TYPES_TREA"
+ "TMENT_UNSPECIFIED\020\000\022\027\n\023INCLUDE_ALL_CREDI"
+ "TS\020\001\022\027\n\023EXCLUDE_ALL_CREDITS\020\002By\n(com.goo"
+ "gle.cloud.billing.budgets.v1beta1P\001ZKgoo"
+ "gle.golang.org/genproto/googleapis/cloud"
+ "/billing/budgets/v1beta1;budgetsb\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand Down Expand Up @@ -161,7 +162,10 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_descriptor,
new java.lang.String[] {
"PubsubTopic", "SchemaVersion", "MonitoringNotificationChannels",
"PubsubTopic",
"SchemaVersion",
"MonitoringNotificationChannels",
"DisableDefaultIamRecipients",
});
internal_static_google_cloud_billing_budgets_v1beta1_Filter_descriptor =
getDescriptor().getMessageTypes().get(5);
Expand Down
Expand Up @@ -85,7 +85,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ " \003(\0132,.google.cloud.billing.budgets.v1be"
+ "ta1.Budget\022\027\n\017next_page_token\030\002 \001(\t\"Q\n\023D"
+ "eleteBudgetRequest\022:\n\004name\030\001 \001(\tB,\340A\002\372A&"
+ "\n$billingbudgets.googleapis.com/Budget2\311"
+ "\n$billingbudgets.googleapis.com/Budget2\367"
+ "\007\n\rBudgetService\022\257\001\n\014CreateBudget\0229.goog"
+ "le.cloud.billing.budgets.v1beta1.CreateB"
+ "udgetRequest\032,.google.cloud.billing.budg"
Expand All @@ -108,12 +108,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ ".cloud.billing.budgets.v1beta1.DeleteBud"
+ "getRequest\032\026.google.protobuf.Empty\"3\202\323\344\223"
+ "\002-*+/v1beta1/{name=billingAccounts/*/bud"
+ "gets/*}\032Q\312A\035billingbudgets.googleapis.co"
+ "m\322A.https://www.googleapis.com/auth/clou"
+ "d-platformBy\n(com.google.cloud.billing.b"
+ "udgets.v1beta1P\001ZKgoogle.golang.org/genp"
+ "roto/googleapis/cloud/billing/budgets/v1"
+ "beta1;budgetsb\006proto3"
+ "gets/*}\032\177\312A\035billingbudgets.googleapis.co"
+ "m\322A\\https://www.googleapis.com/auth/clou"
+ "d-billing,https://www.googleapis.com/aut"
+ "h/cloud-platformBy\n(com.google.cloud.bil"
+ "ling.budgets.v1beta1P\001ZKgoogle.golang.or"
+ "g/genproto/googleapis/cloud/billing/budg"
+ "ets/v1beta1;budgetsb\006proto3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand Down