Skip to content

Commit

Permalink
feat: Supported project-level-budgets in Public Budget API V1
Browse files Browse the repository at this point in the history
Added `scope` for project scope filter in `ListBudgetsRequest`. When this field is set to a project's resource name, the budgets returned are tracking the costs for the given project.

feat: Added `enable_project_level_recipients` for project owner budget emails

Setting this field to true will enable email notification to project owners for project-level budgets.

PiperOrigin-RevId: 559152052

Source-Link: googleapis/googleapis@113867b

Source-Link: googleapis/googleapis-gen@017d177
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuQmlsbGluZy5CdWRnZXRzLlYxLy5Pd2xCb3QueWFtbCIsImgiOiIwMTdkMTc3ZjUxNDY5ZDE1MDQxN2I3YjZhNDVkOTlkOTk2M2Y3ODEzIn0=
  • Loading branch information
gcf-owl-bot[bot] authored and anuragsrivstv committed Aug 23, 2023
1 parent 5de2c9b commit 794fa92
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public async Task ListBudgetsRequestObjectAsync()
ListBudgetsRequest request = new ListBudgetsRequest
{
ParentAsBillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
Scope = "",
};
// Make the request
PagedAsyncEnumerable<ListBudgetsResponse, Budget> response = budgetServiceClient.ListBudgetsAsync(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void ListBudgetsRequestObject()
ListBudgetsRequest request = new ListBudgetsRequest
{
ParentAsBillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
Scope = "",
};
// Make the request
PagedEnumerable<ListBudgetsResponse, Budget> response = budgetServiceClient.ListBudgets(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,12 @@
"segments": [
{
"start": 20,
"end": 79,
"end": 80,
"type": "FULL"
},
{
"start": 37,
"end": 77,
"end": 78,
"type": "SHORT"
}
]
Expand Down Expand Up @@ -887,12 +887,12 @@
"segments": [
{
"start": 20,
"end": 81,
"end": 82,
"type": "FULL"
},
{
"start": 39,
"end": 79,
"end": 80,
"type": "SHORT"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public void ListBudgetsRequestObject()
ListBudgetsRequest request = new ListBudgetsRequest
{
ParentAsBillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
Scope = "",
};
// Make the request
PagedEnumerable<ListBudgetsResponse, Budget> response = budgetServiceClient.ListBudgets(request);
Expand Down Expand Up @@ -329,6 +330,7 @@ public async Task ListBudgetsRequestObjectAsync()
ListBudgetsRequest request = new ListBudgetsRequest
{
ParentAsBillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
Scope = "",
};
// Make the request
PagedAsyncEnumerable<ListBudgetsResponse, Budget> response = budgetServiceClient.ListBudgetsAsync(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,42 +47,43 @@ public static partial class BudgetModelReflection {
"aG9sZF9wZXJjZW50GAEgASgBQgPgQQISTgoLc3BlbmRfYmFzaXMYAiABKA4y",
"NC5nb29nbGUuY2xvdWQuYmlsbGluZy5idWRnZXRzLnYxLlRocmVzaG9sZFJ1",
"bGUuQmFzaXNCA+BBASJHCgVCYXNpcxIVChFCQVNJU19VTlNQRUNJRklFRBAA",
"EhEKDUNVUlJFTlRfU1BFTkQQARIUChBGT1JFQ0FTVEVEX1NQRU5EEAIipwEK",
"EhEKDUNVUlJFTlRfU1BFTkQQARIUChBGT1JFQ0FTVEVEX1NQRU5EEAIi1QEK",
"EU5vdGlmaWNhdGlvbnNSdWxlEhkKDHB1YnN1Yl90b3BpYxgBIAEoCUID4EEB",
"EhsKDnNjaGVtYV92ZXJzaW9uGAIgASgJQgPgQQESLQogbW9uaXRvcmluZ19u",
"b3RpZmljYXRpb25fY2hhbm5lbHMYAyADKAlCA+BBARIrCh5kaXNhYmxlX2Rl",
"ZmF1bHRfaWFtX3JlY2lwaWVudHMYBCABKA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pb2QYCSAB",
"KAsyLS5nb29nbGUuY2xvdWQuYmlsbGluZy5idWRnZXRzLnYxLkN1c3RvbVBl",
"cmlvZEID4EEBSAAaSQoLTGFiZWxzRW50cnkSCwoDa2V5GAEgASgJEikKBXZh",
"bHVlGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RWYWx1ZToCOAEijwEK",
"FENyZWRpdFR5cGVzVHJlYXRtZW50EiYKIkNSRURJVF9UWVBFU19UUkVBVE1F",
"TlRfVU5TUEVDSUZJRUQQABIXChNJTkNMVURFX0FMTF9DUkVESVRTEAESFwoT",
"RVhDTFVERV9BTExfQ1JFRElUUxACEh0KGUlOQ0xVREVfU1BFQ0lGSUVEX0NS",
"RURJVFMQA0IOCgx1c2FnZV9wZXJpb2QiZAoMQ3VzdG9tUGVyaW9kEioKCnN0",
"YXJ0X2RhdGUYASABKAsyES5nb29nbGUudHlwZS5EYXRlQgPgQQISKAoIZW5k",
"X2RhdGUYAiABKAsyES5nb29nbGUudHlwZS5EYXRlQgPgQQEqUwoOQ2FsZW5k",
"YXJQZXJpb2QSHwobQ0FMRU5EQVJfUEVSSU9EX1VOU1BFQ0lGSUVEEAASCQoF",
"TU9OVEgQARILCgdRVUFSVEVSEAISCAoEWUVBUhADQngKI2NvbS5nb29nbGUu",
"Y2xvdWQuYmlsbGluZy5idWRnZXRzLnYxQhBCdWRnZXRNb2RlbFByb3RvUAFa",
"PWNsb3VkLmdvb2dsZS5jb20vZ28vYmlsbGluZy9idWRnZXRzL2FwaXYxL2J1",
"ZGdldHNwYjtidWRnZXRzcGJiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Api.FieldBehaviorReflection.Descriptor, global::Google.Api.ResourceReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Type.DateReflection.Descriptor, global::Google.Type.MoneyReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Cloud.Billing.Budgets.V1.CalendarPeriod), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.Budget), global::Google.Cloud.Billing.Budgets.V1.Budget.Parser, new[]{ "Name", "DisplayName", "BudgetFilter", "Amount", "ThresholdRules", "NotificationsRule", "Etag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.BudgetAmount), global::Google.Cloud.Billing.Budgets.V1.BudgetAmount.Parser, new[]{ "SpecifiedAmount", "LastPeriodAmount" }, new[]{ "BudgetAmount" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.LastPeriodAmount), global::Google.Cloud.Billing.Budgets.V1.LastPeriodAmount.Parser, null, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.ThresholdRule), global::Google.Cloud.Billing.Budgets.V1.ThresholdRule.Parser, new[]{ "ThresholdPercent", "SpendBasis" }, null, new[]{ typeof(global::Google.Cloud.Billing.Budgets.V1.ThresholdRule.Types.Basis) }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.NotificationsRule), global::Google.Cloud.Billing.Budgets.V1.NotificationsRule.Parser, new[]{ "PubsubTopic", "SchemaVersion", "MonitoringNotificationChannels", "DisableDefaultIamRecipients" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.NotificationsRule), global::Google.Cloud.Billing.Budgets.V1.NotificationsRule.Parser, new[]{ "PubsubTopic", "SchemaVersion", "MonitoringNotificationChannels", "DisableDefaultIamRecipients", "EnableProjectLevelRecipients" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.Filter), global::Google.Cloud.Billing.Budgets.V1.Filter.Parser, new[]{ "Projects", "ResourceAncestors", "CreditTypes", "CreditTypesTreatment", "Services", "Subaccounts", "Labels", "CalendarPeriod", "CustomPeriod" }, new[]{ "UsagePeriod" }, new[]{ typeof(global::Google.Cloud.Billing.Budgets.V1.Filter.Types.CreditTypesTreatment) }, null, new pbr::GeneratedClrTypeInfo[] { null, }),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Billing.Budgets.V1.CustomPeriod), global::Google.Cloud.Billing.Budgets.V1.CustomPeriod.Parser, new[]{ "StartDate", "EndDate" }, null, null, null, null)
}));
Expand Down Expand Up @@ -1385,6 +1386,7 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
schemaVersion_ = other.schemaVersion_;
monitoringNotificationChannels_ = other.monitoringNotificationChannels_.Clone();
disableDefaultIamRecipients_ = other.disableDefaultIamRecipients_;
enableProjectLevelRecipients_ = other.enableProjectLevelRecipients_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}

Expand Down Expand Up @@ -1507,6 +1509,27 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
}
}

/// <summary>Field number for the "enable_project_level_recipients" field.</summary>
public const int EnableProjectLevelRecipientsFieldNumber = 5;
private bool enableProjectLevelRecipients_;
/// <summary>
/// Optional. When set to true, and when the budget has a single project
/// configured, notifications will be sent to project level recipients of that
/// project. This field will be ignored if the budget has multiple or no
/// project configured.
///
/// Currently, project level recipients are the users with `Owner` role on a
/// cloud project.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool EnableProjectLevelRecipients {
get { return enableProjectLevelRecipients_; }
set {
enableProjectLevelRecipients_ = value;
}
}

[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
Expand All @@ -1526,6 +1549,7 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
if (SchemaVersion != other.SchemaVersion) return false;
if(!monitoringNotificationChannels_.Equals(other.monitoringNotificationChannels_)) return false;
if (DisableDefaultIamRecipients != other.DisableDefaultIamRecipients) return false;
if (EnableProjectLevelRecipients != other.EnableProjectLevelRecipients) return false;
return Equals(_unknownFields, other._unknownFields);
}

Expand All @@ -1537,6 +1561,7 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
if (SchemaVersion.Length != 0) hash ^= SchemaVersion.GetHashCode();
hash ^= monitoringNotificationChannels_.GetHashCode();
if (DisableDefaultIamRecipients != false) hash ^= DisableDefaultIamRecipients.GetHashCode();
if (EnableProjectLevelRecipients != false) hash ^= EnableProjectLevelRecipients.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
Expand Down Expand Up @@ -1568,6 +1593,10 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
output.WriteRawTag(32);
output.WriteBool(DisableDefaultIamRecipients);
}
if (EnableProjectLevelRecipients != false) {
output.WriteRawTag(40);
output.WriteBool(EnableProjectLevelRecipients);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
Expand All @@ -1591,6 +1620,10 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
output.WriteRawTag(32);
output.WriteBool(DisableDefaultIamRecipients);
}
if (EnableProjectLevelRecipients != false) {
output.WriteRawTag(40);
output.WriteBool(EnableProjectLevelRecipients);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
Expand All @@ -1611,6 +1644,9 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
if (DisableDefaultIamRecipients != false) {
size += 1 + 1;
}
if (EnableProjectLevelRecipients != false) {
size += 1 + 1;
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
Expand All @@ -1633,6 +1669,9 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
if (other.DisableDefaultIamRecipients != false) {
DisableDefaultIamRecipients = other.DisableDefaultIamRecipients;
}
if (other.EnableProjectLevelRecipients != false) {
EnableProjectLevelRecipients = other.EnableProjectLevelRecipients;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}

Expand Down Expand Up @@ -1664,6 +1703,10 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
DisableDefaultIamRecipients = input.ReadBool();
break;
}
case 40: {
EnableProjectLevelRecipients = input.ReadBool();
break;
}
}
}
#endif
Expand Down Expand Up @@ -1695,6 +1738,10 @@ public sealed partial class NotificationsRule : pb::IMessage<NotificationsRule>
DisableDefaultIamRecipients = input.ReadBool();
break;
}
case 40: {
EnableProjectLevelRecipients = input.ReadBool();
break;
}
}
}
}
Expand Down Expand Up @@ -1790,8 +1837,10 @@ public sealed partial class Filter : pb::IMessage<Filter>
/// Optional. A set of folder and organization names of the form
/// `folders/{folderId}` or `organizations/{organizationId}`, specifying that
/// usage from only this set of folders and organizations should be included in
/// the budget. If omitted, the report includes all usage for all
/// organizations, regardless of which organization the usage occurred on.
/// the budget. If omitted, the budget includes all usage that the billing
/// account pays for. If the folder or organization contains projects that are
/// paid for by a different Cloud Billing account, the budget *doesn't* apply
/// to those projects.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
Expand Down
Loading

0 comments on commit 794fa92

Please sign in to comment.