forked from oracle/oci-dotnet-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BudgetWaiters.cs
84 lines (77 loc) · 4.24 KB
/
BudgetWaiters.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/
// NOTE: Code generated by OracleSDKGenerator.
// DO NOT EDIT this file manually.
using System.Linq;
using Oci.Common.Waiters;
using Oci.BudgetService.Models;
using Oci.BudgetService.Requests;
using Oci.BudgetService.Responses;
namespace Oci.BudgetService
{
/// <summary>
/// Contains collection of helper methods to produce Oci.Common.Waiters for different resources of Budget.
/// </summary>
public class BudgetWaiters
{
private readonly BudgetClient client;
public BudgetWaiters(BudgetClient client)
{
this.client = client;
}
/// <summary>
/// Creates a waiter using default wait configuration.
/// </summary>
/// <param name="request">Request to send.</param>
/// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
/// <returns>a new Oci.common.Waiter instance</returns>
public Waiter<GetAlertRuleRequest, GetAlertRuleResponse> ForAlertRule(GetAlertRuleRequest request, params LifecycleState[] targetStates)
{
return this.ForAlertRule(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates);
}
/// <summary>
/// Creates a waiter using the provided configuration.
/// </summary>
/// <param name="request">Request to send.</param>
/// <param name="config">Wait Configuration</param>
/// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
/// <returns>a new Oci.common.Waiter instance</returns>
public Waiter<GetAlertRuleRequest, GetAlertRuleResponse> ForAlertRule(GetAlertRuleRequest request, WaiterConfiguration config, params LifecycleState[] targetStates)
{
var agent = new WaiterAgent<GetAlertRuleRequest, GetAlertRuleResponse>(
request,
request => client.GetAlertRule(request),
response => targetStates.Contains(response.AlertRule.LifecycleState.Value)
);
return new Waiter<GetAlertRuleRequest, GetAlertRuleResponse>(config, agent);
}
/// <summary>
/// Creates a waiter using default wait configuration.
/// </summary>
/// <param name="request">Request to send.</param>
/// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
/// <returns>a new Oci.common.Waiter instance</returns>
public Waiter<GetBudgetRequest, GetBudgetResponse> ForBudget(GetBudgetRequest request, params LifecycleState[] targetStates)
{
return this.ForBudget(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates);
}
/// <summary>
/// Creates a waiter using the provided configuration.
/// </summary>
/// <param name="request">Request to send.</param>
/// <param name="config">Wait Configuration</param>
/// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
/// <returns>a new Oci.common.Waiter instance</returns>
public Waiter<GetBudgetRequest, GetBudgetResponse> ForBudget(GetBudgetRequest request, WaiterConfiguration config, params LifecycleState[] targetStates)
{
var agent = new WaiterAgent<GetBudgetRequest, GetBudgetResponse>(
request,
request => client.GetBudget(request),
response => targetStates.Contains(response.Budget.LifecycleState.Value)
);
return new Waiter<GetBudgetRequest, GetBudgetResponse>(config, agent);
}
}
}