content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|
using System;
using System.Data;
using System.Data.Common;
using System.Dynamic;
using System.Linq.Expressions;
using System.Reflection;
namespace SqlProfiler
{
/// <summary>
/// Generic <see cref="DbCommand"/> wrapper with dynamic tricks to allow easy access to driver-specific properties of wrapped command
/// </summary>
public class CommandWrapper : DbCommand, IDynamicMetaObjectProvider
{
/// <summary>
/// The wrapped command
/// </summary>
/// <returns></returns>
/// <remarks>This is public for simple debugging by the user; the call to <see cref="DelegatingMetaObject"/> needs to add <see cref="BindingFlags.Public"/> to match.</remarks>
public DbCommand Wrapped { get; }
private readonly PropertyInfo _DbConnection;
private readonly PropertyInfo _DbParameterCollection;
private readonly PropertyInfo _DbTransaction;
private readonly MethodInfo _CreateDbParameter;
private readonly MethodInfo _ExecuteDbDataReader;
/// <summary>
/// Constructor
/// </summary>
/// <param name="wrapped">The command to wrap</param>
public CommandWrapper(DbCommand wrapped)
{
Wrapped = wrapped;
// Get all the protected elements which we need to pass back to the wrapped object
var type = wrapped.GetType();
_DbConnection = type.GetNonPublicProperty("DbConnection");
_DbParameterCollection = type.GetNonPublicProperty("DbParameterCollection");
_DbTransaction = type.GetNonPublicProperty("DbTransaction");
_CreateDbParameter = type.GetNonPublicMethod("CreateDbParameter", Type.EmptyTypes);
_ExecuteDbDataReader = type.GetNonPublicMethod("ExecuteDbDataReader", new Type[] { typeof(CommandBehavior) });
}
/// <summary>
/// Supports dynamically getting and setting properties on the wrapped DbCommand
/// </summary>
/// <param name="expression"></param>
/// <returns></returns>
public DynamicMetaObject GetMetaObject(Expression expression)
{
return new DelegatingMetaObject(expression, this, nameof(Wrapped), BindingFlags.Instance | BindingFlags.Public);
}
/// <summary>
/// Wrapped <see cref="DbCommand.CommandText"/> property
/// </summary>
public override string CommandText
{
get { return Wrapped.CommandText; }
set { Wrapped.CommandText = value; }
}
/// <summary>
/// Wrapped <see cref="DbCommand.CommandTimeout"/> property
/// </summary>
public override int CommandTimeout
{
get { return Wrapped.CommandTimeout; }
set { Wrapped.CommandTimeout = value; }
}
/// <summary>
/// Wrapped <see cref="DbCommand.CommandType"/> property
/// </summary>
public override CommandType CommandType
{
get { return Wrapped.CommandType; }
set { Wrapped.CommandType = value; }
}
/// <summary>
/// Wrapped <see cref="DbCommand.DesignTimeVisible"/> property
/// </summary>
public override bool DesignTimeVisible
{
get { return Wrapped.DesignTimeVisible; }
set { Wrapped.DesignTimeVisible = value; }
}
/// <summary>
/// Wrapped <see cref="DbCommand.UpdatedRowSource"/> property
/// </summary>
public override UpdateRowSource UpdatedRowSource
{
get { return Wrapped.UpdatedRowSource; }
set { Wrapped.UpdatedRowSource = value; }
}
/// <summary>
/// Wrapped non-public <see cref="DbCommand.DbConnection"/> property
/// </summary>
protected override DbConnection DbConnection
{
get { return (DbConnection)_DbConnection.GetValue(Wrapped); }
set { _DbConnection.SetValue(Wrapped, (DbConnection)value); }
}
/// <summary>
/// Wrapped non-public <see cref="DbCommand.DbParameterCollection "/> property
/// </summary>
protected override DbParameterCollection DbParameterCollection
{
get { return (DbParameterCollection)_DbParameterCollection.GetValue(Wrapped); }
}
/// <summary>
/// Wrapped non-public <see cref="DbCommand.DbTransaction"/> property
/// </summary>
protected override DbTransaction DbTransaction { get { return (DbTransaction)_DbTransaction.GetValue(Wrapped); } set { _DbTransaction.SetValue(Wrapped, (DbTransaction)value); } }
/// <summary>
/// Wrapped <see cref="DbCommand.Cancel"/> method, with <see cref="PreCancel(DbCommand)"/> and <see cref="PostCancel(DbCommand, object)"/> hooks
/// </summary>
public override void Cancel()
{
var profilingObject = PreCancel(Wrapped);
Wrapped.Cancel();
PostCancel(Wrapped, profilingObject);
}
/// <summary>
/// Pre-<see cref="DbCommand.Cancel"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <returns></returns>
protected virtual object PreCancel(DbCommand command) { return null; }
/// <summary>
/// Post-<see cref="DbCommand.Cancel"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <param name="profilingObject">Whatever was returned from <see cref="PreCancel(DbCommand)"/></param>
/// <returns></returns>
protected virtual void PostCancel(DbCommand command, object profilingObject) {}
/// <summary>
/// Wrapped <see cref="DbCommand.ExecuteNonQuery"/> method, with <see cref="PreExecuteNonQuery(DbCommand)"/> and <see cref="PostExecuteNonQuery(DbCommand, object)"/> hooks
/// </summary>
/// <returns></returns>
public override int ExecuteNonQuery()
{
var profilingObject = PreExecuteNonQuery(Wrapped);
var result = Wrapped.ExecuteNonQuery();
PostExecuteNonQuery(Wrapped, profilingObject);
return result;
}
/// <summary>
/// Pre-<see cref="DbCommand.ExecuteNonQuery"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <returns></returns>
protected virtual object PreExecuteNonQuery(DbCommand command) { return null; }
/// <summary>
/// Post-<see cref="DbCommand.ExecuteNonQuery"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <param name="profilingObject">Whatever was returned from the pre-method hook</param>
/// <returns></returns>
protected virtual void PostExecuteNonQuery(DbCommand command, object profilingObject) {}
/// <summary>
/// Wrapped <see cref="DbCommand.ExecuteScalar"/> method, with <see cref="PreExecuteScalar(DbCommand)"/> and <see cref="PostExecuteScalar(DbCommand, object)"/> hooks
/// </summary>
/// <returns></returns>
public override object ExecuteScalar()
{
var profilingObject = PreExecuteScalar(Wrapped);
var result = Wrapped.ExecuteScalar();
PostExecuteScalar(Wrapped, profilingObject);
return result;
}
/// <summary>
/// Pre-<see cref="DbCommand.ExecuteScalar"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <returns></returns>
protected virtual object PreExecuteScalar(DbCommand command) { return null; }
/// <summary>
/// Post-<see cref="DbCommand.ExecuteScalar"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <param name="profilingObject">Whatever was returned from the pre-method hook</param>
/// <returns></returns>
protected virtual void PostExecuteScalar(DbCommand command, object profilingObject) {}
/// <summary>
/// Wrapped <see cref="DbCommand.Prepare"/> method, with <see cref="PrePrepare(DbCommand)"/> and <see cref="PostPrepare(DbCommand, object)"/> hooks
/// </summary>
public override void Prepare()
{
var profilingObject = PrePrepare(Wrapped);
Wrapped.Prepare();
PostPrepare(Wrapped, profilingObject);
}
/// <summary>
/// Pre-<see cref="DbCommand.Prepare"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <returns></returns>
protected virtual object PrePrepare(DbCommand command) { return null; }
/// <summary>
/// Post-<see cref="DbCommand.Prepare"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <param name="profilingObject">Whatever was returned from the pre-method hook</param>
/// <returns></returns>
protected virtual void PostPrepare(DbCommand command, object profilingObject) {}
/// <summary>
/// Wrapped non-public <see cref="DbCommand.CreateDbParameter"/> method, with <see cref="PreCreateDbParameter(DbCommand)"/> and <see cref="PostCreateDbParameter(DbCommand, object)"/> hooks
/// </summary>
/// <returns></returns>
protected override DbParameter CreateDbParameter()
{
var profilingObject = PreCreateDbParameter(Wrapped);
DbParameter param;
try
{
param = (DbParameter)_CreateDbParameter.Invoke(Wrapped, null);
}
catch (TargetInvocationException ex)
{
throw ex.InnerException;
}
PostCreateDbParameter(Wrapped, profilingObject);
return param;
}
/// <summary>
/// Pre-<see cref="DbCommand.CreateDbParameter"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <returns></returns>
protected virtual object PreCreateDbParameter(DbCommand command) { return null; }
/// <summary>
/// Post-<see cref="DbCommand.CreateDbParameter"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <param name="profilingObject">Whatever was returned from the pre-method hook</param>
/// <returns></returns>
protected virtual void PostCreateDbParameter(DbCommand command, object profilingObject) {}
/// <summary>
/// Wrapped non-public <see cref="DbCommand.ExecuteDbDataReader(CommandBehavior)"/> method, with <see cref="PreExecuteDbDataReader(DbCommand, CommandBehavior)"/> and <see cref="PostExecuteDbDataReader(DbCommand, CommandBehavior, object)"/> hooks
/// </summary>
/// <param name="behavior">The command behavior</param>
/// <returns></returns>
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
{
var profilingObject = PreExecuteDbDataReader(Wrapped, behavior);
DbDataReader reader;
try
{
reader = (DbDataReader)_ExecuteDbDataReader.Invoke(Wrapped, new object[] { behavior });
}
catch (TargetInvocationException ex)
{
throw ex.InnerException;
}
PostExecuteDbDataReader(Wrapped, behavior, profilingObject);
return reader;
}
/// <summary>
/// Pre-<see cref="DbCommand.ExecuteDbDataReader(CommandBehavior)"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <param name="behavior">The command behavior</param>
/// <returns></returns>
protected virtual object PreExecuteDbDataReader(DbCommand command, CommandBehavior behavior) { return null; }
/// <summary>
/// Post-<see cref="DbCommand.ExecuteDbDataReader(CommandBehavior)"/> hook
/// </summary>
/// <param name="command">The wrapped command</param>
/// <param name="behavior">The command behavior</param>
/// <param name="profilingObject">Whatever was returned from the pre-method hook</param>
/// <returns></returns>
protected virtual void PostExecuteDbDataReader(DbCommand command, CommandBehavior behavior, object profilingObject) {}
}
}
| 39.770764 | 253 | 0.63871 | [
"BSD-3-Clause"
] | MightyOrm/SqlProfiler | CommandWrapper.cs | 11,973 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PlexMovieName")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexMovieName")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("172580c3-3e77-46b4-a3d7-fd4171eb0cc5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.675676 | 84 | 0.748207 | [
"MIT"
] | Lokukarawita/MediaUtilz | src/PlexMovieName/Properties/AssemblyInfo.cs | 1,397 | C# |
using Microsoft.AspNetCore.Http;
namespace Exceptionless.Web.Controllers {
public class PermissionResult {
public bool Allowed { get; set; }
public string Id { get; set; }
public string Message { get; set; }
public int StatusCode { get; set; }
public static PermissionResult Allow = new PermissionResult { Allowed = true, StatusCode = StatusCodes.Status200OK };
public static PermissionResult Deny = new PermissionResult { Allowed = false, StatusCode = StatusCodes.Status400BadRequest };
public static PermissionResult DenyWithNotFound(string id = null) {
return new PermissionResult {
Allowed = false,
Id = id,
StatusCode = StatusCodes.Status404NotFound
};
}
public static PermissionResult DenyWithMessage(string message, string id = null) {
return new PermissionResult {
Allowed = false,
Id = id,
Message = message,
StatusCode = StatusCodes.Status400BadRequest
};
}
public static PermissionResult DenyWithStatus(int statusCode, string message = null, string id = null) {
return new PermissionResult {
Allowed = false,
Id = id,
Message = message,
StatusCode = statusCode
};
}
public static PermissionResult DenyWithPlanLimitReached(string message, string id = null) {
return new PermissionResult {
Allowed = false,
Id = id,
Message = message,
StatusCode = StatusCodes.Status426UpgradeRequired
};
}
}
} | 34.019231 | 133 | 0.574336 | [
"Apache-2.0"
] | aTiKhan/Exceptionless | src/Exceptionless.Web/Controllers/Base/PermissionResult.cs | 1,771 | C# |
// Copyright (C) Microsoft. All rights reserved. Licensed under the MIT License.
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.ApplicationInspector.RulesEngine
{
/// <summary>
/// Class to handle text as a searchable container
/// </summary>
public class TextContainer
{
/// <summary>
/// Creates new instance
/// </summary>
/// <param name="content"> Text to work with </param>
/// <param name="language"> The language of the test </param>
/// <param name="lineNumber"> The line number to specify. Leave empty for full file as target. </param>
public TextContainer(string content, string language)
{
Language = language;
FullContent = content;
LineEnds = new List<int>() { 0 };
LineStarts = new List<int>() { 0, 0 };
// Find line end in the text
int pos = FullContent.IndexOf('\n');
while (pos > -1)
{
LineEnds.Add(pos);
if (pos + 1 < FullContent.Length)
{
LineStarts.Add(pos + 1);
}
pos = FullContent.IndexOf('\n', pos + 1);
}
if (LineEnds.Count < LineStarts.Count)
{
LineEnds.Add(FullContent.Length - 1);
}
prefix = RulesEngine.Language.GetCommentPrefix(Language);
suffix = RulesEngine.Language.GetCommentSuffix(Language);
inline = RulesEngine.Language.GetCommentInline(Language);
}
/// <summary>
/// The full string of the TextContainer representes.
/// </summary>
public string FullContent { get; }
/// <summary>
/// The code language of the file
/// </summary>
public string Language { get; }
/// <summary>
/// One-indexed array of the character indexes of the ends of the lines in FullContent.
/// </summary>
public List<int> LineEnds { get; }
/// <summary>
/// One-indexed array of the character indexes of the starts of the lines in FullContent.
/// </summary>
public List<int> LineStarts { get; }
/// <summary>
/// A dictionary mapping character index in FullContent to if a specific character is commented. See IsCommented to use.
/// </summary>
private ConcurrentDictionary<int,bool> CommentedStates { get; } = new();
/// <summary>
/// Populates the CommentedStates Dictionary based on the index and the provided comment prefix and suffix
/// </summary>
/// <param name="index">The character index in FullContent</param>
/// <param name="prefix">The comment prefix</param>
/// <param name="suffix">The comment suffix</param>
private void PopulateCommentedStatesInternal(int index, string prefix, string suffix)
{
var prefixLoc = FullContent.LastIndexOf(prefix, index, StringComparison.Ordinal);
if (prefixLoc != -1)
{
if (!CommentedStates.ContainsKey(prefixLoc))
{
var suffixLoc = FullContent.IndexOf(suffix, prefixLoc, StringComparison.Ordinal);
if (suffixLoc == -1)
{
suffixLoc = FullContent.Length - 1;
}
for (int i = prefixLoc; i <= suffixLoc; i++)
{
CommentedStates[i] = true;
}
}
}
}
/// <summary>
/// Populate the CommentedStates Dictionary based on the provided index.
/// </summary>
/// <param name="index">The character index in FullContent to work based on.</param>
public void PopulateCommentedState(int index)
{
var inIndex = index;
if (index >= FullContent.Length)
{
index = FullContent.Length - 1;
}
if (index < 0)
{
index = 0;
}
// Populate true for the indexes of the most immediately preceding instance of the multiline comment type if found
if (!string.IsNullOrEmpty(prefix) && !string.IsNullOrEmpty(suffix))
{
PopulateCommentedStatesInternal(index, prefix, suffix);
}
// Populate true for indexes of the most immediately preceding instance of the single-line comment type if found
if (!CommentedStates.ContainsKey(index) && !string.IsNullOrEmpty(inline))
{
PopulateCommentedStatesInternal(index, inline, "\n");
}
var i = index;
// Everything preceding this, including this, which doesn't have a commented state is
// therefore not commented so we backfill
while (!CommentedStates.ContainsKey(i) && i >= 0)
{
CommentedStates[i--] = false;
}
if (inIndex != index)
{
CommentedStates[inIndex] = CommentedStates[index];
}
}
/// <summary>
/// Gets the text for a given boundary
/// </summary>
/// <param name="boundary">The boundary to get text for.</param>
/// <returns></returns>
public string GetBoundaryText(Boundary boundary)
{
if (boundary is null)
{
return string.Empty;
}
var start = Math.Max(boundary.Index, 0);
var end = start + boundary.Length;
start = Math.Min(FullContent.Length, start);
end = Math.Min(FullContent.Length, end);
return FullContent[start..end];
}
/// <summary>
/// Returns boundary for a given index in text
/// </summary>
/// <param name="index"> Position in text </param>
/// <returns> Boundary </returns>
public Boundary GetLineBoundary(int index)
{
Boundary result = new();
for (int i = 0; i < LineEnds.Count; i++)
{
if (LineEnds[i] >= index)
{
result.Index = LineStarts[i];
result.Length = LineEnds[i] - LineStarts[i] + 1;
break;
}
}
return result;
}
/// <summary>
/// Return content of the line
/// </summary>
/// <param name="line"> Line number (one-indexed) </param>
/// <returns> Text </returns>
public string GetLineContent(int line)
{
if (line >= LineEnds.Count)
{
line = LineEnds.Count - 1;
}
int index = LineEnds[line];
Boundary bound = GetLineBoundary(index);
return FullContent.Substring(bound.Index, bound.Length);
}
/// <summary>
/// Returns location (Line, Column) for given index in text
/// </summary>
/// <param name="index"> Position in text (line is one-indexed)</param>
/// <returns> Location </returns>
public Location GetLocation(int index)
{
Location result = new();
if (index == 0)
{
result.Line = 1;
result.Column = 1;
}
else
{
for (int i = 0; i < LineEnds.Count; i++)
{
if (LineEnds[i] >= index)
{
result.Line = i;
result.Column = index - LineStarts[i];
break;
}
}
}
return result;
}
public bool IsCommented(int index)
{
if (!CommentedStates.ContainsKey(index))
{
PopulateCommentedState(index);
}
return CommentedStates[index];
}
/// <summary>
/// Check whether the boundary in a text matches the scope of a search pattern (code, comment etc.)
/// </summary>
/// <param name="pattern"> The scopes to check </param>
/// <param name="boundary"> Boundary in the text </param>
/// <param name="text"> Text </param>
/// <returns> True if boundary is in a provided scope </returns>
public bool ScopeMatch(IEnumerable<PatternScope> scopes, Boundary boundary)
{
if (scopes is null)
{
return true;
}
if (scopes.Contains(PatternScope.All) || string.IsNullOrEmpty(prefix))
return true;
bool isInComment = IsCommented(boundary.Index);
return (!isInComment && scopes.Contains(PatternScope.Code)) || (isInComment && scopes.Contains(PatternScope.Comment));
}
private readonly string inline;
private readonly string prefix;
private readonly string suffix;
}
} | 36.015564 | 130 | 0.515233 | [
"MIT"
] | guyacosta/ApplicationInspector | RulesEngine/TextContainer.cs | 9,258 | C# |
using System.Text;
using EventStore.Client;
using Newtonsoft.Json.Linq;
using ES.Core.Events;
namespace ES.EventStoreDb.Extensions;
public static class EventsExtension
{
public static Event AsEvent(this EventRecord eventRecord) => new(GetEventJson(eventRecord));
public static AggregateEvent AsAggregateEvent(this Event @event) => new(@event);
public static AggregateEvent AsAggregateEvent(this EventRecord eventRecord) => new(GetEventJson(eventRecord));
#region Helpers
private static JObject GetEventJson(EventRecord eventRecord)
{
var eventDataAsString = Encoding.UTF8.GetString(eventRecord.Data.Span);
var eventMetadataAsString = Encoding.UTF8.GetString(eventRecord.Metadata.Span);
var @event = JObject.Parse(eventMetadataAsString);
var eventData = JObject.Parse(eventDataAsString);
@event["data"] = eventData;
@event["eventNumber"] = eventRecord.EventNumber.ToString();
return @event;
}
#endregion
} | 31.65625 | 114 | 0.726555 | [
"Apache-2.0"
] | v-oleg/ES | ES.EventStoreDb/Extensions/EventsExtension.cs | 1,013 | C# |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.RecoveryServices.Backup.Models
{
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Filters to list backup copies.
/// </summary>
public partial class BMSRPQueryObject
{
/// <summary>
/// Initializes a new instance of the BMSRPQueryObject class.
/// </summary>
public BMSRPQueryObject()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the BMSRPQueryObject class.
/// </summary>
/// <param name="startDate">Backup copies created after this
/// time.</param>
/// <param name="endDate">Backup copies created before this
/// time.</param>
/// <param name="restorePointQueryType">RestorePoint type. Possible
/// values include: 'Invalid', 'Full', 'Log', 'Differential',
/// 'FullAndDifferential', 'All', 'Incremental'</param>
/// <param name="extendedInfo">In Get Recovery Point, it tells whether
/// extended information about recovery point is asked.</param>
/// <param name="moveReadyRPOnly">Whether the RP can be moved to
/// another tier</param>
public BMSRPQueryObject(System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string restorePointQueryType = default(string), bool? extendedInfo = default(bool?), bool? moveReadyRPOnly = default(bool?))
{
StartDate = startDate;
EndDate = endDate;
RestorePointQueryType = restorePointQueryType;
ExtendedInfo = extendedInfo;
MoveReadyRPOnly = moveReadyRPOnly;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets backup copies created after this time.
/// </summary>
[JsonProperty(PropertyName = "startDate")]
public System.DateTime? StartDate { get; set; }
/// <summary>
/// Gets or sets backup copies created before this time.
/// </summary>
[JsonProperty(PropertyName = "endDate")]
public System.DateTime? EndDate { get; set; }
/// <summary>
/// Gets or sets restorePoint type. Possible values include: 'Invalid',
/// 'Full', 'Log', 'Differential', 'FullAndDifferential', 'All',
/// 'Incremental'
/// </summary>
[JsonProperty(PropertyName = "restorePointQueryType")]
public string RestorePointQueryType { get; set; }
/// <summary>
/// Gets or sets in Get Recovery Point, it tells whether extended
/// information about recovery point is asked.
/// </summary>
[JsonProperty(PropertyName = "extendedInfo")]
public bool? ExtendedInfo { get; set; }
/// <summary>
/// Gets or sets whether the RP can be moved to another tier
/// </summary>
[JsonProperty(PropertyName = "moveReadyRPOnly")]
public bool? MoveReadyRPOnly { get; set; }
}
}
| 38.16129 | 266 | 0.615103 | [
"MIT"
] | 93mishra/azure-sdk-for-net | sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/recoveryservicesbackup/Generated/Models/BMSRPQueryObject.cs | 3,549 | C# |
using TMPro;
using UnityEngine;
namespace MokomoGames.UI
{
public class UIRankConfirm : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI currentRankText;
[SerializeField] private UIGaugeWithUpperLabel expGauge;
[SerializeField] private UIGaugeWithUpperLabel staminaGauge;
public void SetCurrentRank(uint rank)
{
currentRankText.text = rank.ToString();
}
public void SetExpGauge(uint remainingExp, uint maxExp)
{
expGauge.SetRemainingValue($"あと{remainingExp}");
expGauge.SetRemainingSliderValue(remainingExp, maxExp);
}
public void SetStaminaGauge(uint minutes, uint seconds, uint maxRecoverySeconds)
{
staminaGauge.SetRemainingValue($"あと{minutes:00}:{seconds:00}");
staminaGauge.SetRemainingSliderValue(minutes * 60 + seconds, maxRecoverySeconds);
}
}
} | 32.206897 | 93 | 0.669165 | [
"MIT"
] | sim-mokomo/ECity | Assets/Scripts/UI/UIRankConfirm.cs | 944 | C# |
//-----------------------------------------------------------------------
// <copyright file="CompressorModel.cs" company="SRON">
// Copyright (c) 2017 SRON
// </copyright>
//-----------------------------------------------------------------------
namespace CryostatControlClient.Models
{
using System;
using System.Collections.Generic;
using Dragablz.Dockablz;
/// <summary>
/// The compressor model.
/// </summary>
public class CompressorModel
{
#region Fields
#endregion Fields
#region Properties
/// <summary>
/// Gets or sets the state of operation.
/// </summary>
/// <value>
/// The state of operiation.
/// </value>
public double OperatingState { get; set; } = -1;
/// <summary>
/// Gets or sets the state of the warning.
/// </summary>
/// <value>
/// The state of the warning.
/// </value>
public double WarningState { get; set; }
/// <summary>
/// Gets or sets the state of the error.
/// </summary>
/// <value>
/// The state of the error.
/// </value>
public double ErrorState { get; set; }
/// <summary>
/// Gets or sets the water in temperature.
/// </summary>
/// <value>
/// The water in temperature.
/// </value>
public double WaterInTemp { get; set; }
/// <summary>
/// Gets or sets the water out temperature.
/// </summary>
/// <value>
/// The water out temperature.
/// </value>
public double WaterOutTemp { get; set; }
/// <summary>
/// Gets or sets the oil temperature.
/// </summary>
/// <value>
/// The oil temperature.
/// </value>
public double OilTemp { get; set; }
/// <summary>
/// Gets or sets the helium temperature.
/// </summary>
/// <value>
/// The helium temperature.
/// </value>
public double HeliumTemp { get; set; }
/// <summary>
/// Gets or sets the low pressure.
/// </summary>
/// <value>
/// The low pressure.
/// </value>
public double LowPressure { get; set; }
/// <summary>
/// Gets or sets the low pressure average.
/// </summary>
/// <value>
/// The low pressure average.
/// </value>
public double LowPressureAverage { get; set; }
/// <summary>
/// Gets or sets the high pressure.
/// </summary>
/// <value>
/// The high pressure.
/// </value>
public double HighPressure { get; set; }
/// <summary>
/// Gets or sets the high pressure average.
/// </summary>
/// <value>
/// The high pressure average.
/// </value>
public double HighPressureAverage { get; set; }
/// <summary>
/// Gets or sets the delta pressure average.
/// </summary>
/// <value>
/// The delta pressure average.
/// </value>
public double DeltaPressureAverage { get; set; }
/// <summary>
/// Gets or sets the hours of operation.
/// </summary>
/// <value>
/// The hours of operation.
/// </value>
public double HoursOfOperation { get; set; }
/// <summary>
/// Gets or sets the pressure scale.
/// </summary>
/// <value>
/// The pressure scale.
/// </value>
public double PressureScale { get; set; } = -1;
/// <summary>
/// Gets or sets the temperature scale.
/// </summary>
/// <value>
/// The temperature scale.
/// </value>
public double TempScale { get; set; } = -1;
/// <summary>
/// Gets or sets the connection state.
/// </summary>
/// <value>
/// The connection state.
/// </value>
public double ConnectionState { get; set; }
#endregion Properties
}
} | 27.032468 | 73 | 0.46553 | [
"MIT"
] | BBekker/CryostatControl | CryostatControlClient/Models/CompressorModel.cs | 4,163 | C# |
using System;
using System.Collections.ObjectModel;
using Telerik.UI.Xaml.Controls.Data;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace SDKExamples.UWP.Listview
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class PullToRefresh : ExamplePageBase
{
ObservableCollection<int> source = new ObservableCollection<int>() { 1, 2, 3, 4, 5, 6 };
public PullToRefresh()
{
this.InitializeComponent();
this.DataContext = this.source;
}
private void RefreshRequested(object sender, EventArgs e)
{
this.source.Add(this.source.Count + 1);
this.source.Add(this.source.Count + 1);
this.source.Add(this.source.Count + 1);
this.source.Add(this.source.Count + 1);
(sender as RadListView).IsPullToRefreshActive = false;
}
}
}
| 29.971429 | 96 | 0.63489 | [
"Apache-2.0"
] | ChristianGutman/UI-For-UWP | SDKExamples.UWP/Examples/ListView/PullToRefresh.xaml.cs | 1,051 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(AutoMapperInWebAPI.Startup))]
namespace AutoMapperInWebAPI
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
| 18.157895 | 59 | 0.686957 | [
"MIT"
] | peteratseneca/dps907fall2018 | Week_01/AutoMapperInWebAPI/AutoMapperInWebAPI/Startup.cs | 347 | C# |
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Traccar_Control_Panel_WPF
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
| 18.833333 | 42 | 0.716814 | [
"MIT"
] | Cale-Torino/Traccar_Control_Panel | WPF/Traccar_Control_Panel_WPF/Forms/App.xaml.cs | 341 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Aws.WafV2.Outputs
{
[OutputType]
public sealed class WebAclRuleActionCountCustomRequestHandlingInsertHeader
{
/// <summary>
/// The name of the custom header. For custom request header insertion, when AWS WAF inserts the header into the request, it prefixes this name `x-amzn-waf-`, to avoid confusion with the headers that are already in the request. For example, for the header name `sample`, AWS WAF inserts the header `x-amzn-waf-sample`.
/// </summary>
public readonly string Name;
/// <summary>
/// The value of the custom header.
/// </summary>
public readonly string Value;
[OutputConstructor]
private WebAclRuleActionCountCustomRequestHandlingInsertHeader(
string name,
string value)
{
Name = name;
Value = value;
}
}
}
| 34 | 326 | 0.663399 | [
"ECL-2.0",
"Apache-2.0"
] | alexbowers/pulumi-aws | sdk/dotnet/WafV2/Outputs/WebAclRuleActionCountCustomRequestHandlingInsertHeader.cs | 1,224 | C# |
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using System.Web;
using log4net;
using Nini.Config;
using Mono.Addins;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Services.Connectors.SimianGrid
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianExternalCapsModule")]
public class SimianExternalCapsModule : INonSharedRegionModule, IExternalCapsModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_enabled = true;
private Scene m_scene;
private String m_simianURL;
#region IRegionModule Members
public string Name
{
get { return this.GetType().Name; }
}
public void Initialise(IConfigSource config)
{
try
{
IConfig m_config;
if ((m_config = config.Configs["SimianExternalCaps"]) != null)
{
m_enabled = m_config.GetBoolean("Enabled", m_enabled);
if ((m_config = config.Configs["SimianGrid"]) != null)
{
m_simianURL = m_config.GetString("SimianServiceURL");
if (String.IsNullOrEmpty(m_simianURL))
{
//m_log.DebugFormat("[SimianGrid] service URL is not defined");
m_enabled = false;
return;
}
}
}
else
m_enabled = false;
}
catch (Exception e)
{
m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
return;
}
}
public void PostInitialise() { }
public void Close() { }
public void AddRegion(Scene scene)
{
if (! m_enabled)
return;
m_scene = scene;
m_scene.RegisterModuleInterface<IExternalCapsModule>(this);
}
public void RemoveRegion(Scene scene)
{
if (! m_enabled)
return;
m_scene.EventManager.OnRegisterCaps -= RegisterCapsEventHandler;
m_scene.EventManager.OnDeregisterCaps -= DeregisterCapsEventHandler;
}
public void RegionLoaded(Scene scene)
{
if (! m_enabled)
return;
m_scene.EventManager.OnRegisterCaps += RegisterCapsEventHandler;
m_scene.EventManager.OnDeregisterCaps += DeregisterCapsEventHandler;
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
#region IExternalCapsModule
// Eg http://grid.sciencesim.com/GridPublic/%CAP%/%OP%/"
public bool RegisterExternalUserCapsHandler(UUID agentID, Caps caps, String capName, String urlSkel)
{
UUID cap = UUID.Random();
// Call to simian to register the cap we generated
// NameValueCollection requestArgs = new NameValueCollection
// {
// { "RequestMethod", "AddCapability" },
// { "Resource", "user" },
// { "Expiration", 0 },
// { "OwnerID", agentID.ToString() },
// { "CapabilityID", cap.ToString() }
// };
// OSDMap response = SimianGrid.PostToService(m_simianURL, requestArgs);
Dictionary<String,String> subs = new Dictionary<String,String>();
subs["%OP%"] = capName;
subs["%USR%"] = agentID.ToString();
subs["%CAP%"] = cap.ToString();
subs["%SIM%"] = m_scene.RegionInfo.RegionID.ToString();
caps.RegisterHandler(capName,ExpandSkeletonURL(urlSkel,subs));
return true;
}
#endregion
#region EventHandlers
public void RegisterCapsEventHandler(UUID agentID, Caps caps) { }
public void DeregisterCapsEventHandler(UUID agentID, Caps caps) { }
#endregion
private String ExpandSkeletonURL(String urlSkel, Dictionary<String,String> subs)
{
String result = urlSkel;
foreach (KeyValuePair<String,String> kvp in subs)
{
result = result.Replace(kvp.Key,kvp.Value);
}
return result;
}
}
} | 35.327778 | 111 | 0.614405 | [
"BSD-3-Clause"
] | SignpostMarv/opensim | OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs | 6,361 | C# |
// "Therefore those skilled at the unorthodox
// are infinite as heaven and earth,
// inexhaustible as the great rivers.
// When they come to an end,
// they begin again,
// like the days and months;
// they die and are reborn,
// like the four seasons."
//
// - Sun Tsu,
// "The Art of War"
using System;
using System.Collections.Generic;
namespace Ribbon.HtmlRenderer.Core.Entities
{
/// <summary>
/// Invoked when a stylesheet is about to be loaded by file path or URL in 'link' element.<br/>
/// Allows to overwrite the loaded stylesheet by providing the stylesheet data manually, or different source (file or URL) to load from.<br/>
/// Example: The stylesheet 'href' can be non-valid URI string that is interpreted in the overwrite delegate by custom logic to pre-loaded stylesheet object<br/>
/// If no alternative data is provided the original source will be used.<br/>
/// </summary>
public sealed class HtmlStylesheetLoadEventArgs : EventArgs
{
#region Fields and Consts
/// <summary>
/// the source of the stylesheet as found in the HTML (file path or URL)
/// </summary>
private readonly string _src;
/// <summary>
/// collection of all the attributes that are defined on the link element
/// </summary>
private readonly Dictionary<string, string> _attributes;
/// <summary>
/// provide the new source (file path or URL) to load stylesheet from
/// </summary>
private string _setSrc;
/// <summary>
/// provide the stylesheet to load
/// </summary>
private string _setStyleSheet;
/// <summary>
/// provide the stylesheet data to load
/// </summary>
private CssData _setStyleSheetData;
#endregion
/// <summary>
/// Init.
/// </summary>
/// <param name="src">the source of the image (file path or URL)</param>
/// <param name="attributes">collection of all the attributes that are defined on the image element</param>
internal HtmlStylesheetLoadEventArgs(string src, Dictionary<string, string> attributes)
{
_src = src;
_attributes = attributes;
}
/// <summary>
/// the source of the stylesheet as found in the HTML (file path or URL)
/// </summary>
public string Src
{
get { return _src; }
}
/// <summary>
/// collection of all the attributes that are defined on the link element
/// </summary>
public Dictionary<string, string> Attributes
{
get { return _attributes; }
}
/// <summary>
/// provide the new source (file path or URL) to load stylesheet from
/// </summary>
public string SetSrc
{
get { return _setSrc; }
set { _setSrc = value; }
}
/// <summary>
/// provide the stylesheet to load
/// </summary>
public string SetStyleSheet
{
get { return _setStyleSheet; }
set { _setStyleSheet = value; }
}
/// <summary>
/// provide the stylesheet data to load
/// </summary>
public CssData SetStyleSheetData
{
get { return _setStyleSheetData; }
set { _setStyleSheetData = value; }
}
}
} | 31.327273 | 165 | 0.583575 | [
"BSD-3-Clause"
] | xxami/htmlrenderer-dotnetcore | Ribbon.HtmlRenderer/Core/Entities/HtmlStylesheetLoadEventArgs.cs | 3,446 | C# |
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* 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 http://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.
*/
using System;
using QuantConnect.Interfaces;
using QuantConnect.Orders;
namespace QuantConnect.Tests.Brokerages
{
/// <summary>
/// Helper class to abstract test cases from individual order types
/// </summary>
public abstract class OrderTestParameters
{
public Symbol Symbol { get; private set; }
public SecurityType SecurityType { get; private set; }
public IOrderProperties Properties { get; private set; }
public OrderSubmissionData OrderSubmissionData { get; internal set; }
protected OrderTestParameters(Symbol symbol, IOrderProperties properties = null, OrderSubmissionData orderSubmissionData = null)
{
Symbol = symbol;
SecurityType = symbol.ID.SecurityType;
Properties = properties;
OrderSubmissionData = orderSubmissionData;
}
public MarketOrder CreateLongMarketOrder(decimal quantity)
{
return new MarketOrder(Symbol, Math.Abs(quantity), DateTime.Now, properties: Properties)
{
OrderSubmissionData = OrderSubmissionData
};
}
public MarketOrder CreateShortMarketOrder(decimal quantity)
{
return new MarketOrder(Symbol, -Math.Abs(quantity), DateTime.Now, properties: Properties)
{
OrderSubmissionData = OrderSubmissionData
};
}
/// <summary>
/// Creates a sell order of this type
/// </summary>
public abstract Order CreateShortOrder(decimal quantity);
/// <summary>
/// Creates a long order of this type
/// </summary>
public abstract Order CreateLongOrder(decimal quantity);
/// <summary>
/// Modifies the order so it is more likely to fill
/// </summary>
public abstract bool ModifyOrderToFill(IBrokerage brokerage, Order order, decimal lastMarketPrice);
/// <summary>
/// The status to expect when submitting this order, typically just Submitted,
/// unless market order, then Filled
/// </summary>
public abstract OrderStatus ExpectedStatus { get; }
/// <summary>
/// The status to expect when cancelling this order
/// </summary>
public abstract bool ExpectedCancellationResult { get; }
/// <summary>
/// True to continue modifying the order until it is filled, false otherwise
/// </summary>
public virtual bool ModifyUntilFilled => true;
}
}
| 39.156627 | 136 | 0.657538 | [
"Apache-2.0"
] | Algoman2010/Lean | Tests/Brokerages/OrderTestParameters.cs | 3,250 | C# |
//Copyright (c) 2018 Yardi Technology Limited. Http://www.kooboo.com
//All rights reserved.
using Kooboo.Data.Context;
using Kooboo.Data.Interface;
using System;
using System.Collections.Generic;
namespace Kooboo.Sites.Scripting
{
public static class ExtensionContainer
{
private static object _locker = new object();
private static Dictionary<string, Type> _list;
public static Dictionary<string, Type> List
{
get
{
if (_list == null)
{
lock (_locker)
{
if (_list == null)
{
_list = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
foreach (var item in Lib.Reflection.AssemblyLoader.LoadTypeByInterface(typeof(IkScript)))
{
var instance = Activator.CreateInstance(item) as IkScript;
if (instance != null)
{
_list.Add(instance.Name, item);
}
}
}
}
}
return _list;
}
}
public static IkScript Get(string name, RenderContext context)
{
if (string.IsNullOrEmpty(name))
{
return null;
}
if (List.ContainsKey(name))
{
var type = List[name];
var instance = Activator.CreateInstance(type) as IkScript;
if (instance !=null)
{
instance.context = context;
return instance;
}
}
return null;
}
public static void Set(IkScript script)
{
}
}
}
| 27.219178 | 117 | 0.433317 | [
"MIT"
] | VZhiLinCorp/Kooboo | Kooboo.Sites/Scripting/ExtensionContainer.cs | 1,987 | C# |
using System.Runtime.Serialization;
namespace EncompassRest.Loans.Enums
{
public enum UlddMortgageOriginator
{
Broker = 0,
Lender = 1,
Correspondent = 2
}
} | 17.545455 | 38 | 0.637306 | [
"MIT"
] | gashach/EncompassRest | src/EncompassRest/Loans/Enums/UlddMortgageOriginator.cs | 193 | C# |
using MediatR;
namespace SFA.DAS.ProviderApprenticeshipsService.Application.Commands.DeleteCommitment
{
public sealed class DeleteCommitmentCommand : IRequest
{
public string UserId { get; set; }
public long ProviderId { get; set; }
public long CommitmentId { get; set; }
public string UserEmailAddress { get; set; }
public string UserDisplayName { get; set; }
}
}
| 29.928571 | 86 | 0.680191 | [
"MIT"
] | SkillsFundingAgency/das-providerapprenticeshipsservice | src/SFA.DAS.ProviderApprenticeshipsService.Application/Commands/DeleteCommitment/DeleteCommitmentCommand.cs | 421 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WeiqiUX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WeiqiUX")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1c30bf54-3eeb-4be0-a67b-907973cd09a4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.277778 | 84 | 0.749627 | [
"Apache-2.0"
] | sunchun1979/weiqiz | weiqiz/WeiqiUX/Properties/AssemblyInfo.cs | 1,345 | C# |
using System;
using System.IO;
using System.Xml.Serialization;
namespace Codice.CmdRunner
{
[Serializable]
public class LaunchCommandConfig
{
public string FullServerCommand;
public string CmShellComand;
public string AllServerPrefixCommand;
public string ClientPath;
}
public class LaunchCommand
{
public static void SetExecutablePath(string executablepath)
{
mExecutablePath = executablepath;
}
public static LaunchCommand Get()
{
if (mInstance == null)
mInstance = new LaunchCommand();
return mInstance;
}
public string GetFullServerCommand()
{
return mConfig.FullServerCommand;
}
public string GetCmShellCommand()
{
return mConfig.CmShellComand;
}
public string GetAllServerPrefixCommand()
{
return mConfig.AllServerPrefixCommand;
}
public string GetClientPath()
{
return mConfig.ClientPath;
}
static LaunchCommandConfig LoadFromFile(string file)
{
FileStream reader = new FileStream(file, FileMode.Open, FileAccess.Read);
XmlSerializer ser = new XmlSerializer(typeof(LaunchCommandConfig));
return (LaunchCommandConfig)ser.Deserialize(reader);
}
LaunchCommand()
{
string file = "launchcommand.conf";
if (File.Exists(file))
{
mConfig = LoadFromFile(file);
}
else
{
mConfig = new LaunchCommandConfig();
}
if (String.IsNullOrEmpty(mConfig.FullServerCommand))
mConfig.FullServerCommand = "[SERVERPATH]plasticd --console";
if (String.IsNullOrEmpty(mConfig.CmShellComand))
mConfig.CmShellComand = string.Format("{0} shell --logo", mExecutablePath);
if (mConfig.ClientPath == null)
mConfig.ClientPath = string.Empty;
if (mConfig.CmShellComand == null)
mConfig.CmShellComand = string.Empty;
}
static LaunchCommand mInstance = null;
static string mExecutablePath = "cm";
LaunchCommandConfig mConfig;
}
}
| 26.47191 | 91 | 0.57725 | [
"MIT"
] | PlasticSCM/syncservertrigger | syncservertrigger/syncservertrigger/cmdrunner/LaunchCommand.cs | 2,358 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nyuzi_StackTracer {
public class LogBoxItem : BoxItem {
string disp_string;
string info_string;
bool correctness;
int stack_record_idx;
Int32 thread_id;
public int Stack_record_idx {
get {
return stack_record_idx;
}
set {
stack_record_idx = value;
}
}
public Int32 GetThreadID() { return thread_id; }
public LogBoxItem(List<TraceRecord> records,int idx,ObjdumpSymtabParser symtab) {
TraceRecord content = records[idx];
stack_record_idx = idx;
thread_id = content.thread_id;
correctness = (content.pc_valid && content.target_valid);
FuncRecord pc_sym, target_sym;
pc_sym = symtab.QueryFuncSymByOffset(content.pc);
target_sym = symtab.QueryFuncSymByOffset(content.target);
disp_string = "[" + idx + "] " + "Thread-" + content.thread_id + " " + content.type.ToString();
if (content.pc_valid) {
disp_string += " <" + SymbolUtils.GenerateSymbolDisp(content.pc,pc_sym) + ">";
if (!SymbolUtils.CheckSymCorrectness(content.pc,pc_sym)) {
correctness = false;
}
} else {
disp_string += "0x" + content.pc_orig;
}
disp_string += " -->";
if (content.target_valid) {
disp_string += " <" + SymbolUtils.GenerateSymbolDisp(content.target,target_sym) + ">";
if (!SymbolUtils.CheckSymCorrectness(content.target,target_sym)) {
correctness = false;
}
} else {
disp_string += " 0x" + content.target_orig;
}
info_string = content.time + "/T " + content.type.ToString() + " 0x" + content.pc_orig + " ->" + " 0x" + content.target_orig;
if (!content.pc_valid || !content.target_valid) {
info_string += " # error address.";
} else if (!correctness) {
info_string += " # abnormal address.";
}
}
public override bool GetCorrectness() { return correctness; }
public override string ToString() { return disp_string; }
public override string GetInfo() { return info_string; }
}
}
| 34.819444 | 137 | 0.552054 | [
"MIT"
] | s117/Nyuzi_StackTracer | Nyuzi_StackTracer/LogBoxItem.cs | 2,509 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
namespace Azure.ResourceManager.Cdn.Models
{
/// <summary> Deletes an existing delivery rule within a rule set. </summary>
public partial class AfdRuleDeleteOperation : Operation
{
private readonly OperationInternals _operation;
/// <summary> Initializes a new instance of AfdRuleDeleteOperation for mocking. </summary>
protected AfdRuleDeleteOperation()
{
}
internal AfdRuleDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response)
{
_operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.AzureAsyncOperation, "AfdRuleDeleteOperation");
}
/// <inheritdoc />
public override string Id => _operation.Id;
/// <inheritdoc />
public override bool HasCompleted => _operation.HasCompleted;
/// <inheritdoc />
public override Response GetRawResponse() => _operation.GetRawResponse();
/// <inheritdoc />
public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken);
/// <inheritdoc />
public override ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken);
/// <inheritdoc />
public override ValueTask<Response> WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken);
/// <inheritdoc />
public override ValueTask<Response> WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken);
}
}
| 39.388889 | 229 | 0.732957 | [
"MIT"
] | 93mishra/azure-sdk-for-net | sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/LongRunningOperation/AfdRuleDeleteOperation.cs | 2,127 | C# |
using Imagin.Common.Linq;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
namespace Imagin.Common.Controls
{
public class TransformAdorner : Adorner
{
#region Properties
/// <summary>
/// Resizing adorner uses Thumbs for visual elements.
/// The Thumbs have built-in mouse input handling.
/// </summary>
Thumb top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight;
public double SnapToGrid { get; set; } = 16d;
Style thumbStyle = null;
public Style ThumbStyle
{
get => thumbStyle;
set
{
thumbStyle = value;
}
}
/// <summary>
/// To store and manage the adorner’s visual children.
/// </summary>
VisualCollection visualChildren;
/// <summary>
/// Override the VisualChildrenCount and GetVisualChild
/// properties to interface with the adorner’s visual
/// collection.
/// </summary>
protected override int VisualChildrenCount => visualChildren.Count;
#endregion
#region TransformAdorner
readonly FrameworkElement Element;
public TransformAdorner(UIElement element, double snapToGrid, Style resizeThumbStyle) : base(element)
{
Element = element as FrameworkElement;
SnapToGrid = snapToGrid;
ThumbStyle = resizeThumbStyle;
if (Element == null)
throw new NotSupportedException();
visualChildren = new VisualCollection(this);
BuildAdornerCorner(ref top, Cursors.SizeNS);
BuildAdornerCorner(ref left, Cursors.SizeWE);
BuildAdornerCorner(ref right, Cursors.SizeWE);
BuildAdornerCorner(ref bottom, Cursors.SizeNS);
BuildAdornerCorner(ref topLeft, Cursors.SizeNWSE);
BuildAdornerCorner(ref topRight, Cursors.SizeNESW);
BuildAdornerCorner(ref bottomLeft, Cursors.SizeNESW);
BuildAdornerCorner(ref bottomRight, Cursors.SizeNWSE);
top.DragDelta
+= new DragDeltaEventHandler(HandleTop);
left.DragDelta
+= new DragDeltaEventHandler(HandleLeft);
right.DragDelta
+= new DragDeltaEventHandler(HandleRight);
bottom.DragDelta
+= new DragDeltaEventHandler(HandleBottom);
topLeft.DragDelta
+= new DragDeltaEventHandler(HandleTopLeft);
topRight.DragDelta
+= new DragDeltaEventHandler(HandleTopRight);
bottomLeft.DragDelta
+= new DragDeltaEventHandler(HandleBottomLeft);
bottomRight.DragDelta
+= new DragDeltaEventHandler(HandleBottomRight);
/*
rotateLine = new System.Windows.Shapes.Rectangle()
{
Fill = Brushes.Black,
Height = 20,
Width = 1
};
visualChildren.Add(rotateLine);
rotateSphere = new Thumb()
{
Background = Brushes.Black,
Height = 10,
BorderBrush = Brushes.White,
BorderThickness = new Thickness(1),
Style = rotateThumbStyle,
Width = 10
};
rotateSphere.DragDelta += new DragDeltaEventHandler(OnRotating);
rotateSphere.DragStarted += new DragStartedEventHandler(OnRotateStarted);
visualChildren.Add(rotateSphere);
*/
}
//System.Windows.Shapes.Rectangle rotateLine;
//Thumb rotateSphere;
#endregion
#region Methods
bool CanHandle(Thumb Thumb)
{
var result = true;
if (AdornedElement == null || Thumb == null)
result = false;
if (result)
EnforceSize(AdornedElement as FrameworkElement);
return result;
}
/*
Canvas canvas;
Point centerPoint;
double initialAngle;
RotateTransform rotateTransform;
System.Windows.Vector startVector;
void OnRotating(object sender, DragDeltaEventArgs e)
{
if (CanHandle(sender as Thumb))
{
if (Element != null && canvas != null)
{
Point currentPoint = Mouse.GetPosition(canvas);
System.Windows.Vector deltaVector = Point.Subtract(currentPoint, centerPoint);
double angle = System.Windows.Vector.AngleBetween(startVector, deltaVector);
RotateTransform rotateTransform = Element.RenderTransform as RotateTransform;
rotateTransform.Angle = initialAngle + Math.Round(angle, 0);
Element.RenderTransformOrigin = new Point(0.5, 0.5);
Element.InvalidateMeasure();
ControlExtensions.SetRotation(Element, rotateTransform.Angle);
}
}
}
void OnRotateStarted(object sender, DragStartedEventArgs e)
{
if (CanHandle(sender as Thumb))
{
if (Element != null)
{
canvas = VisualTreeHelper.GetParent(Element) as Canvas;
if (canvas != null)
{
centerPoint = Element.TranslatePoint(new Point(Element.Width * Element.RenderTransformOrigin.X, Element.Height * Element.RenderTransformOrigin.Y), canvas);
Point startPoint = Mouse.GetPosition(canvas);
startVector = Point.Subtract(startPoint, centerPoint);
rotateTransform = Element.RenderTransform as RotateTransform;
if (rotateTransform == null)
{
Element.RenderTransform = new RotateTransform(0);
initialAngle = 0;
}
else initialAngle = this.rotateTransform.Angle;
}
}
}
}
*/
/// <summary>
/// Handler for resizing from the bottom-right.
/// </summary>
void HandleBottomRight(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
Adorned.Width = System.Math.Max(Adorned.Width + args.HorizontalChange, Thumb.DesiredSize.Width).NearestFactor(SnapToGrid);
Adorned.Height = System.Math.Max(args.VerticalChange + Adorned.Height, Thumb.DesiredSize.Height).NearestFactor(SnapToGrid);
}
}
/// <summary>
/// Handler for resizing from the top-right.
/// </summary>
void HandleTopRight(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
Adorned.Width = System.Math.Max(Adorned.Width + args.HorizontalChange, Thumb.DesiredSize.Width).NearestFactor(SnapToGrid);
var height_old = Adorned.Height;
var height_new = System.Math.Max(Adorned.Height - args.VerticalChange, Thumb.DesiredSize.Height).NearestFactor(SnapToGrid);
var top_old = Canvas.GetTop(Adorned);
Adorned.Height = height_new;
Canvas.SetTop(Adorned, top_old - (height_new - height_old));
}
}
/// <summary>
/// Handler for resizing from the top-left.
/// </summary>
void HandleTopLeft(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
var width_old = Adorned.Width;
var width_new = System.Math.Max(Adorned.Width - args.HorizontalChange, Thumb.DesiredSize.Width).NearestFactor(SnapToGrid);
var left_old = Canvas.GetLeft(Adorned);
Adorned.Width = width_new;
Canvas.SetLeft(Adorned, left_old - (width_new - width_old));
var height_old = Adorned.Height;
var height_new = System.Math.Max(Adorned.Height - args.VerticalChange, Thumb.DesiredSize.Height).NearestFactor(SnapToGrid);
var top_old = Canvas.GetTop(Adorned);
Adorned.Height = height_new;
Canvas.SetTop(Adorned, top_old - (height_new - height_old));
}
}
/// <summary>
/// Handler for resizing from the bottom-left.
/// </summary>
void HandleBottomLeft(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
Adorned.Height = System.Math.Max(args.VerticalChange + Adorned.Height, Thumb.DesiredSize.Height).NearestFactor(SnapToGrid);
var width_old = Adorned.Width;
var width_new = System.Math.Max(Adorned.Width - args.HorizontalChange, Thumb.DesiredSize.Width).NearestFactor(SnapToGrid);
var left_old = Canvas.GetLeft(Adorned);
Adorned.Width = width_new;
Canvas.SetLeft(Adorned, left_old - (width_new - width_old));
}
}
/// <summary>
/// Handler for resizing from the top.
/// </summary>
void HandleTop(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
var height_old = Adorned.Height;
var height_new = System.Math.Max(Adorned.Height - args.VerticalChange, Thumb.DesiredSize.Height).NearestFactor(SnapToGrid);
var top_old = Canvas.GetTop(Adorned);
var top_new = top_old - (height_new - height_old);
Adorned.Height = height_new;
Canvas.SetTop(Adorned, top_new);
}
}
/// <summary>
/// Handler for resizing from the left.
/// </summary>
void HandleLeft(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
var width_old = Adorned.Width;
var width_new = System.Math.Max(Adorned.Width - args.HorizontalChange, Thumb.DesiredSize.Width).NearestFactor(SnapToGrid);
var left_old = Canvas.GetLeft(Adorned);
var left_new = left_old - (width_new - width_old);
Adorned.Width = width_new;
Canvas.SetLeft(Adorned, left_new);
}
}
/// <summary>
/// Handler for resizing from the right.
/// </summary>
void HandleRight(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
var width = System.Math.Max(Adorned.Width + args.HorizontalChange, Thumb.DesiredSize.Width);
Adorned.Width = width.NearestFactor(SnapToGrid);
}
}
/// <summary>
/// Handler for resizing from the bottom.
/// </summary>
void HandleBottom(object sender, DragDeltaEventArgs args)
{
var Adorned = this.AdornedElement as FrameworkElement;
var Thumb = sender as Thumb;
if (CanHandle(Thumb))
{
var height = System.Math.Max(args.VerticalChange + Adorned.Height, Thumb.DesiredSize.Height);
Adorned.Height = height.NearestFactor(SnapToGrid);
}
}
/// <summary>
/// Helper method to instantiate the corner Thumbs,
/// set the Cursor property, set some appearance properties,
/// and add the elements to the visual tree.
/// </summary>
void BuildAdornerCorner(ref Thumb Thumb, Cursor Cursor)
{
if (Thumb == null)
{
Thumb = new Thumb()
{
Background = Brushes.Black,
BorderThickness = new Thickness(0),
Cursor = Cursor,
Height = 10,
Style = ThumbStyle,
Width = 10,
};
visualChildren.Add(Thumb);
}
}
/// <summary>
/// This method ensures that the Widths and Heights
/// are initialized. Sizing to content produces Width
/// and Height values of Double.NaN. Because this Adorner
/// explicitly resizes, the Width and Height need to be
/// set first. It also sets the maximum size of the
/// adorned element.
/// </summary>
void EnforceSize(FrameworkElement Adorned)
{
if (Adorned.Width.Equals(Double.NaN))
Adorned.Width = Adorned.DesiredSize.Width;
if (Adorned.Height.Equals(Double.NaN))
Adorned.Height = Adorned.DesiredSize.Height;
var parent = Adorned.Parent as FrameworkElement;
if (parent != null)
{
Adorned.MaxHeight = parent.ActualHeight;
Adorned.MaxWidth = parent.ActualWidth;
}
}
/// <summary>
/// Arrange the Adorners.
/// </summary>
protected override Size ArrangeOverride(Size finalSize)
{
//desiredWidth and desiredHeight are the width and height of the element that’s being adorned; these will be used to place the TransformAdorner at the corners of the adorned element.
double desiredWidth = AdornedElement.DesiredSize.Width;
double desiredHeight = AdornedElement.DesiredSize.Height;
//adornerWidth & adornerHeight are used for placement as well.
double adornerWidth = this.DesiredSize.Width;
double adornerHeight = this.DesiredSize.Height;
//rotateLine.Arrange(new Rect((desiredWidth / 2) - (adornerWidth / 2), (-adornerHeight / 2) - 10, adornerWidth, adornerHeight));
//rotateSphere.Arrange(new Rect((desiredWidth / 2) - (adornerWidth / 2), (-adornerHeight / 2) - 20, adornerWidth, adornerHeight));
top.Arrange(new Rect((desiredWidth / 2) - (adornerWidth / 2), -adornerHeight / 2, adornerWidth, adornerHeight));
left.Arrange(new Rect(-adornerWidth / 2, (desiredHeight / 2) - (adornerHeight / 2), adornerWidth, adornerHeight));
right.Arrange(new Rect(desiredWidth - adornerWidth / 2, (desiredHeight / 2) - (adornerHeight / 2), adornerWidth, adornerHeight));
bottom.Arrange(new Rect((desiredWidth / 2) - (adornerWidth / 2), desiredHeight - adornerHeight / 2, adornerWidth, adornerHeight));
topLeft.Arrange(new Rect(-adornerWidth / 2, -adornerHeight / 2, adornerWidth, adornerHeight));
topRight.Arrange(new Rect(desiredWidth - adornerWidth / 2, -adornerHeight / 2, adornerWidth, adornerHeight));
bottomLeft.Arrange(new Rect(-adornerWidth / 2, desiredHeight - adornerHeight / 2, adornerWidth, adornerHeight));
bottomRight.Arrange(new Rect(desiredWidth - adornerWidth / 2, desiredHeight - adornerHeight / 2, adornerWidth, adornerHeight));
return finalSize;
}
protected override Visual GetVisualChild(int index) => visualChildren[index];
#endregion
}
} | 38.361702 | 196 | 0.572318 | [
"BSD-2-Clause"
] | imagin-tech/Imagin.NET | Imagin.Common.WPF/Controls/Other/TransformAdorner.cs | 16,235 | C# |
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin.Security;
using System.Web;
using System;
using Capstone_Project;
namespace Capstone_Project
{
// You can add User data for the user by adding more properties to your User class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
}
#region Helpers
public class UserManager : UserManager<ApplicationUser>
{
public UserManager()
: base(new UserStore<ApplicationUser>(new ApplicationDbContext()))
{
}
}
}
namespace Capstone_Project
{
public static class IdentityHelper
{
// Used for XSRF when linking external logins
public const string XsrfKey = "XsrfId";
public static void SignIn(UserManager manager, ApplicationUser user, bool isPersistent)
{
IAuthenticationManager authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var identity = manager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
}
public const string ProviderNameKey = "providerName";
public static string GetProviderNameFromRequest(HttpRequest request)
{
return request[ProviderNameKey];
}
public static string GetExternalLoginRedirectUrl(string accountProvider)
{
return "/Account/RegisterExternalLogin?" + ProviderNameKey + "=" + accountProvider;
}
private static bool IsLocalUrl(string url)
{
return !string.IsNullOrEmpty(url) && ((url[0] == '/' && (url.Length == 1 || (url[1] != '/' && url[1] != '\\'))) || (url.Length > 1 && url[0] == '~' && url[1] == '/'));
}
public static void RedirectToReturnUrl(string returnUrl, HttpResponse response)
{
if (!String.IsNullOrEmpty(returnUrl) && IsLocalUrl(returnUrl))
{
response.Redirect(returnUrl);
}
else
{
response.Redirect("~/");
}
}
}
#endregion
} | 33.285714 | 179 | 0.635973 | [
"MIT"
] | maziesmith/MS4363-Fall16 | App_Code/IdentityModels.cs | 2,565 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lab3.FeistelCipher.Cryptography
{
public enum CryptoTransformMode
{
Encrypt,
Decrypt
}
}
| 17.266667 | 42 | 0.679537 | [
"MIT"
] | pantosha/University-MZI | Lab3.FeistelCipher/Cryptography/CryptoTransformMode.cs | 261 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace DataStructures.HashTable
{
// Key value look-up
//we want to store the date in an array
public class Hashtable
{
// First We need to set up our Hash Table. Our Hash table will use a node
public class Node
{
public string Key { get; set; }
public string Value { get; set; }
public Node Next { get; set; }
public Node(string key, string value)
{
Key = key;
Value = value;
Next = null;
}
}
//Set Up the Hash
public int Hash(string key)
{
int index;
byte[] bytesTotal = Encoding.ASCII.GetBytes(key);
int letterNumber = 0;
for (int i = 0; i < bytesTotal.Length; i++)
{
letterNumber += bytesTotal[i];
}
index = letterNumber * 1024 % 1147 % Buckets;
return index;
}
//Set up how many buckets are in the HT
public int Buckets { get; set; }
//This sets upthe Node array that will store multiple key/value pairs.
public Node[] HashTableNode { get; set; }
//Next, we set up the HT Constructor. This will set up the quantity for our buckets and set up the same amount of node arrays to match the buckets!
public Hashtable(int buckets)
{
Buckets = buckets;
HashTableNode = new Node[buckets];
}
//Adds an element with the specified key and value into the Hashtable.
public void Add(string key, string value)
{
int index = Hash(key);
if (HashTableNode[index] == null)
{
Node newNode = new Node(key, value);
HashTableNode[index] = newNode;
}
else
{
Node newNode = new Node(key, value);
Node current = HashTableNode[index];
while (current.Next != null)
{
current = current.Next;
}
current.Next = newNode;
}
}
// Get
public string Get(string key)
{
//this is the default for when the string is not found
string returnedText = $"Cannot find key \"{key}\"";
int index = Hash(key);
//if empty return the default
if (HashTableNode[index] == null)
{
return returnedText;
}
//If the node list is not empty, check if the first node has the finding key. If yes, return the node's value.
if (HashTableNode[index] != null)
{
if (HashTableNode[index].Key == key)
{
return HashTableNode[index].Value;
}
else
{
// If not, while the node.Next is not null, keep looping through the node list and look for the finding key. If finds it, return that node's value.
Node current = HashTableNode[index];
while (current.Next != null)
{
current = current.Next;
if (current.Key == key)
{
return current.Value;
}
}
}
}
// If not, return the default string.
return returnedText;
}
//Contains
public bool Contains(string key)
{
int index = Hash(key);
if (HashTableNode[index] == null)
{
return false;
}
else
{
Node current = HashTableNode[index];
if (HashTableNode[index].Key == key) return true;
while (current.Next != null)
{
current = current.Next;
if (current.Key == key)
{
return true;
}
}
return false;
}
}
}
}
| 30.443662 | 167 | 0.455008 | [
"MIT"
] | mrsantons/401-DSA | DataStructures/HashTables/HashTable.cs | 4,325 | C# |
#region "copyright"
/*
Copyright Dale Ghent <daleg@elemental.org>
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
#endregion "copyright"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DaleGhent.NINA.ShutdownPc.Utility {
public class ItemLists {
public static readonly IList<string> ShutdownModes = new List<string> {
"Shutdown",
"Sleep",
};
}
} | 23.740741 | 79 | 0.681747 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | daleghent/nina-shutdown-pc | Utility/ItemLists.cs | 643 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
/*
* Do not modify this file. This file is generated from the waf-2015-08-24.normal.json service model.
*/
using System;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Net;
using Amazon.WAF.Model;
using Amazon.WAF.Model.Internal.MarshallTransformations;
using Amazon.WAF.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.WAF
{
/// <summary>
/// Implementation for accessing WAF
///
/// This is the <i>AWS WAF API Reference</i> for using AWS WAF with Amazon CloudFront.
/// The AWS WAF actions and data types listed in the reference are available for protecting
/// Amazon CloudFront distributions. You can use these actions and data types via the
/// endpoint <i>waf.amazonaws.com</i>. This guide is for developers who need detailed
/// information about the AWS WAF API actions, data types, and errors. For detailed information
/// about AWS WAF features and an overview of how to use the AWS WAF API, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS
/// WAF Developer Guide</a>.
/// </summary>
public partial class AmazonWAFClient : AmazonServiceClient, IAmazonWAF
{
private static IServiceMetadata serviceMetadata = new AmazonWAFMetadata();
#region Constructors
/// <summary>
/// Constructs AmazonWAFClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
public AmazonWAFClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonWAFConfig()) { }
/// <summary>
/// Constructs AmazonWAFClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="region">The region to connect.</param>
public AmazonWAFClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonWAFConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonWAFClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="config">The AmazonWAFClient Configuration Object</param>
public AmazonWAFClient(AmazonWAFConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonWAFClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonWAFClient(AWSCredentials credentials)
: this(credentials, new AmazonWAFConfig())
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonWAFClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonWAFConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Credentials and an
/// AmazonWAFClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonWAFClient Configuration Object</param>
public AmazonWAFClient(AWSCredentials credentials, AmazonWAFConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
public AmazonWAFClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonWAFConfig())
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="region">The region to connect.</param>
public AmazonWAFClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonWAFConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonWAFClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonWAFClient Configuration Object</param>
public AmazonWAFClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonWAFConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
public AmazonWAFClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonWAFConfig())
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="region">The region to connect.</param>
public AmazonWAFClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonWAFConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonWAFClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonWAFClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="clientConfig">The AmazonWAFClient Configuration Object</param>
public AmazonWAFClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonWAFConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
/// <summary>
/// Creates the signer for the service.
/// </summary>
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
/// <summary>
/// Capture metadata for the service.
/// </summary>
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
/// <summary>
/// Disposes the service client.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region CreateByteMatchSet
/// <summary>
/// Creates a <code>ByteMatchSet</code>. You then use <a>UpdateByteMatchSet</a> to identify
/// the part of a web request that you want AWS WAF to inspect, such as the values of
/// the <code>User-Agent</code> header or the query string. For example, you can create
/// a <code>ByteMatchSet</code> that matches any requests with <code>User-Agent</code>
/// headers that contain the string <code>BadBot</code>. You can then configure AWS WAF
/// to reject those requests.
///
///
/// <para>
/// To create and configure a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateByteMatchSet</a> request to specify the part of the request that
/// you want AWS WAF to inspect (for example, the header or the URI) and the value that
/// you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description of the <a>ByteMatchSet</a>. You can't change <code>Name</code> after you create a <code>ByteMatchSet</code>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the CreateByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateByteMatchSet">REST API Reference for CreateByteMatchSet Operation</seealso>
public virtual CreateByteMatchSetResponse CreateByteMatchSet(string name, string changeToken)
{
var request = new CreateByteMatchSetRequest();
request.Name = name;
request.ChangeToken = changeToken;
return CreateByteMatchSet(request);
}
/// <summary>
/// Creates a <code>ByteMatchSet</code>. You then use <a>UpdateByteMatchSet</a> to identify
/// the part of a web request that you want AWS WAF to inspect, such as the values of
/// the <code>User-Agent</code> header or the query string. For example, you can create
/// a <code>ByteMatchSet</code> that matches any requests with <code>User-Agent</code>
/// headers that contain the string <code>BadBot</code>. You can then configure AWS WAF
/// to reject those requests.
///
///
/// <para>
/// To create and configure a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateByteMatchSet</a> request to specify the part of the request that
/// you want AWS WAF to inspect (for example, the header or the URI) and the value that
/// you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateByteMatchSet service method.</param>
///
/// <returns>The response from the CreateByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateByteMatchSet">REST API Reference for CreateByteMatchSet Operation</seealso>
public virtual CreateByteMatchSetResponse CreateByteMatchSet(CreateByteMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateByteMatchSetResponseUnmarshaller.Instance;
return Invoke<CreateByteMatchSetResponse>(request, options);
}
/// <summary>
/// Creates a <code>ByteMatchSet</code>. You then use <a>UpdateByteMatchSet</a> to identify
/// the part of a web request that you want AWS WAF to inspect, such as the values of
/// the <code>User-Agent</code> header or the query string. For example, you can create
/// a <code>ByteMatchSet</code> that matches any requests with <code>User-Agent</code>
/// headers that contain the string <code>BadBot</code>. You can then configure AWS WAF
/// to reject those requests.
///
///
/// <para>
/// To create and configure a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateByteMatchSet</a> request to specify the part of the request that
/// you want AWS WAF to inspect (for example, the header or the URI) and the value that
/// you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description of the <a>ByteMatchSet</a>. You can't change <code>Name</code> after you create a <code>ByteMatchSet</code>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateByteMatchSet">REST API Reference for CreateByteMatchSet Operation</seealso>
public virtual Task<CreateByteMatchSetResponse> CreateByteMatchSetAsync(string name, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new CreateByteMatchSetRequest();
request.Name = name;
request.ChangeToken = changeToken;
return CreateByteMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateByteMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateByteMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateByteMatchSet">REST API Reference for CreateByteMatchSet Operation</seealso>
public virtual Task<CreateByteMatchSetResponse> CreateByteMatchSetAsync(CreateByteMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateByteMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateByteMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region CreateGeoMatchSet
/// <summary>
/// Creates an <a>GeoMatchSet</a>, which you use to specify which web requests you want
/// to allow or block based on the country that the requests originate from. For example,
/// if you're receiving a lot of requests from one or more countries and you want to block
/// the requests, you can create an <code>GeoMatchSet</code> that contains those countries
/// and then configure AWS WAF to block the requests.
///
///
/// <para>
/// To create and configure a <code>GeoMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateGeoMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateGeoMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateGeoMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateGeoMatchSetSet</code> request to specify the countries that
/// you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateGeoMatchSet service method.</param>
///
/// <returns>The response from the CreateGeoMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateGeoMatchSet">REST API Reference for CreateGeoMatchSet Operation</seealso>
public virtual CreateGeoMatchSetResponse CreateGeoMatchSet(CreateGeoMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateGeoMatchSetResponseUnmarshaller.Instance;
return Invoke<CreateGeoMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateGeoMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateGeoMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateGeoMatchSet">REST API Reference for CreateGeoMatchSet Operation</seealso>
public virtual Task<CreateGeoMatchSetResponse> CreateGeoMatchSetAsync(CreateGeoMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateGeoMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateGeoMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region CreateIPSet
/// <summary>
/// Creates an <a>IPSet</a>, which you use to specify which web requests that you want
/// to allow or block based on the IP addresses that the requests originate from. For
/// example, if you're receiving a lot of requests from one or more individual IP addresses
/// or one or more ranges of IP addresses and you want to block the requests, you can
/// create an <code>IPSet</code> that contains those IP addresses and then configure AWS
/// WAF to block the requests.
///
///
/// <para>
/// To create and configure an <code>IPSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateIPSet</code> request to specify the IP addresses that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description of the <a>IPSet</a>. You can't change <code>Name</code> after you create the <code>IPSet</code>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the CreateIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateIPSet">REST API Reference for CreateIPSet Operation</seealso>
public virtual CreateIPSetResponse CreateIPSet(string name, string changeToken)
{
var request = new CreateIPSetRequest();
request.Name = name;
request.ChangeToken = changeToken;
return CreateIPSet(request);
}
/// <summary>
/// Creates an <a>IPSet</a>, which you use to specify which web requests that you want
/// to allow or block based on the IP addresses that the requests originate from. For
/// example, if you're receiving a lot of requests from one or more individual IP addresses
/// or one or more ranges of IP addresses and you want to block the requests, you can
/// create an <code>IPSet</code> that contains those IP addresses and then configure AWS
/// WAF to block the requests.
///
///
/// <para>
/// To create and configure an <code>IPSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateIPSet</code> request to specify the IP addresses that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateIPSet service method.</param>
///
/// <returns>The response from the CreateIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateIPSet">REST API Reference for CreateIPSet Operation</seealso>
public virtual CreateIPSetResponse CreateIPSet(CreateIPSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateIPSetResponseUnmarshaller.Instance;
return Invoke<CreateIPSetResponse>(request, options);
}
/// <summary>
/// Creates an <a>IPSet</a>, which you use to specify which web requests that you want
/// to allow or block based on the IP addresses that the requests originate from. For
/// example, if you're receiving a lot of requests from one or more individual IP addresses
/// or one or more ranges of IP addresses and you want to block the requests, you can
/// create an <code>IPSet</code> that contains those IP addresses and then configure AWS
/// WAF to block the requests.
///
///
/// <para>
/// To create and configure an <code>IPSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateIPSet</code> request to specify the IP addresses that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description of the <a>IPSet</a>. You can't change <code>Name</code> after you create the <code>IPSet</code>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateIPSet">REST API Reference for CreateIPSet Operation</seealso>
public virtual Task<CreateIPSetResponse> CreateIPSetAsync(string name, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new CreateIPSetRequest();
request.Name = name;
request.ChangeToken = changeToken;
return CreateIPSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateIPSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateIPSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateIPSet">REST API Reference for CreateIPSet Operation</seealso>
public virtual Task<CreateIPSetResponse> CreateIPSetAsync(CreateIPSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateIPSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateIPSetResponse>(request, options, cancellationToken);
}
#endregion
#region CreateRateBasedRule
/// <summary>
/// Creates a <a>RateBasedRule</a>. The <code>RateBasedRule</code> contains a <code>RateLimit</code>,
/// which specifies the maximum number of requests that AWS WAF allows from a specified
/// IP address in a five-minute period. The <code>RateBasedRule</code> also contains the
/// <code>IPSet</code> objects, <code>ByteMatchSet</code> objects, and other predicates
/// that identify the requests that you want to count or block if these requests exceed
/// the <code>RateLimit</code>.
///
///
/// <para>
/// If you add more than one predicate to a <code>RateBasedRule</code>, a request not
/// only must exceed the <code>RateLimit</code>, but it also must match all the specifications
/// to be counted or blocked. For example, suppose you add the following to a <code>RateBasedRule</code>:
/// </para>
/// <ul> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44/32</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> </ul>
/// <para>
/// Further, you specify a <code>RateLimit</code> of 15,000.
/// </para>
///
/// <para>
/// You then add the <code>RateBasedRule</code> to a <code>WebACL</code> and specify that
/// you want to block requests that meet the conditions in the rule. For a request to
/// be blocked, it must come from the IP address 192.0.2.44 <i>and</i> the <code>User-Agent</code>
/// header in the request must contain the value <code>BadBot</code>. Further, requests
/// that match these two conditions must be received at a rate of more than 15,000 requests
/// every five minutes. If both conditions are met and the rate is exceeded, AWS WAF blocks
/// the requests. If the rate drops below 15,000 for a five-minute period, AWS WAF no
/// longer blocks the requests.
/// </para>
///
/// <para>
/// As a second example, suppose you want to limit requests to a particular page on your
/// site. To do this, you could add the following to a <code>RateBasedRule</code>:
/// </para>
/// <ul> <li>
/// <para>
/// A <code>ByteMatchSet</code> with <code>FieldToMatch</code> of <code>URI</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>PositionalConstraint</code> of <code>STARTS_WITH</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>TargetString</code> of <code>login</code>
/// </para>
/// </li> </ul>
/// <para>
/// Further, you specify a <code>RateLimit</code> of 15,000.
/// </para>
///
/// <para>
/// By adding this <code>RateBasedRule</code> to a <code>WebACL</code>, you could limit
/// requests to your login page without affecting the rest of your site.
/// </para>
///
/// <para>
/// To create and configure a <code>RateBasedRule</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in the rule. For more information,
/// see <a>CreateByteMatchSet</a>, <a>CreateIPSet</a>, and <a>CreateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateRateBasedRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRule</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRateBasedRule</code> request to specify the predicates that
/// you want to include in the rule.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>RateBasedRule</code>.
/// For more information, see <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateRateBasedRule service method.</param>
///
/// <returns>The response from the CreateRateBasedRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRateBasedRule">REST API Reference for CreateRateBasedRule Operation</seealso>
public virtual CreateRateBasedRuleResponse CreateRateBasedRule(CreateRateBasedRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRateBasedRuleResponseUnmarshaller.Instance;
return Invoke<CreateRateBasedRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateRateBasedRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateRateBasedRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRateBasedRule">REST API Reference for CreateRateBasedRule Operation</seealso>
public virtual Task<CreateRateBasedRuleResponse> CreateRateBasedRuleAsync(CreateRateBasedRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRateBasedRuleResponseUnmarshaller.Instance;
return InvokeAsync<CreateRateBasedRuleResponse>(request, options, cancellationToken);
}
#endregion
#region CreateRegexMatchSet
/// <summary>
/// Creates a <a>RegexMatchSet</a>. You then use <a>UpdateRegexMatchSet</a> to identify
/// the part of a web request that you want AWS WAF to inspect, such as the values of
/// the <code>User-Agent</code> header or the query string. For example, you can create
/// a <code>RegexMatchSet</code> that contains a <code>RegexMatchTuple</code> that looks
/// for any requests with <code>User-Agent</code> headers that match a <code>RegexPatternSet</code>
/// with pattern <code>B[a@]dB[o0]t</code>. You can then configure AWS WAF to reject those
/// requests.
///
///
/// <para>
/// To create and configure a <code>RegexMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateRegexMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateRegexMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateRegexMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateRegexMatchSet</a> request to specify the part of the request that
/// you want AWS WAF to inspect (for example, the header or the URI) and the value, using
/// a <code>RegexPatternSet</code>, that you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateRegexMatchSet service method.</param>
///
/// <returns>The response from the CreateRegexMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRegexMatchSet">REST API Reference for CreateRegexMatchSet Operation</seealso>
public virtual CreateRegexMatchSetResponse CreateRegexMatchSet(CreateRegexMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRegexMatchSetResponseUnmarshaller.Instance;
return Invoke<CreateRegexMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateRegexMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateRegexMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRegexMatchSet">REST API Reference for CreateRegexMatchSet Operation</seealso>
public virtual Task<CreateRegexMatchSetResponse> CreateRegexMatchSetAsync(CreateRegexMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRegexMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateRegexMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region CreateRegexPatternSet
/// <summary>
/// Creates a <code>RegexPatternSet</code>. You then use <a>UpdateRegexPatternSet</a>
/// to specify the regular expression (regex) pattern that you want AWS WAF to search
/// for, such as <code>B[a@]dB[o0]t</code>. You can then configure AWS WAF to reject those
/// requests.
///
///
/// <para>
/// To create and configure a <code>RegexPatternSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateRegexPatternSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateRegexPatternSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateRegexPatternSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateRegexPatternSet</a> request to specify the string that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateRegexPatternSet service method.</param>
///
/// <returns>The response from the CreateRegexPatternSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRegexPatternSet">REST API Reference for CreateRegexPatternSet Operation</seealso>
public virtual CreateRegexPatternSetResponse CreateRegexPatternSet(CreateRegexPatternSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRegexPatternSetResponseUnmarshaller.Instance;
return Invoke<CreateRegexPatternSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateRegexPatternSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateRegexPatternSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRegexPatternSet">REST API Reference for CreateRegexPatternSet Operation</seealso>
public virtual Task<CreateRegexPatternSetResponse> CreateRegexPatternSetAsync(CreateRegexPatternSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRegexPatternSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateRegexPatternSetResponse>(request, options, cancellationToken);
}
#endregion
#region CreateRule
/// <summary>
/// Creates a <code>Rule</code>, which contains the <code>IPSet</code> objects, <code>ByteMatchSet</code>
/// objects, and other predicates that identify the requests that you want to block. If
/// you add more than one predicate to a <code>Rule</code>, a request must match all of
/// the specifications to be allowed or blocked. For example, suppose that you add the
/// following to a <code>Rule</code>:
///
/// <ul> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44/32</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> </ul>
/// <para>
/// You then add the <code>Rule</code> to a <code>WebACL</code> and specify that you want
/// to blocks requests that satisfy the <code>Rule</code>. For a request to be blocked,
/// it must come from the IP address 192.0.2.44 <i>and</i> the <code>User-Agent</code>
/// header in the request must contain the value <code>BadBot</code>.
/// </para>
///
/// <para>
/// To create and configure a <code>Rule</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in the <code>Rule</code>.
/// For more information, see <a>CreateByteMatchSet</a>, <a>CreateIPSet</a>, and <a>CreateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRule</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRule</code> request to specify the predicates that you want
/// to include in the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>Rule</code>. For more
/// information, see <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description of the <a>Rule</a>. You can't change the name of a <code>Rule</code> after you create it.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="metricName">A friendly name or description for the metrics for this <code>Rule</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can't contain white space. You can't change the name of the metric after you create the <code>Rule</code>.</param>
///
/// <returns>The response from the CreateRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRule">REST API Reference for CreateRule Operation</seealso>
public virtual CreateRuleResponse CreateRule(string name, string changeToken, string metricName)
{
var request = new CreateRuleRequest();
request.Name = name;
request.ChangeToken = changeToken;
request.MetricName = metricName;
return CreateRule(request);
}
/// <summary>
/// Creates a <code>Rule</code>, which contains the <code>IPSet</code> objects, <code>ByteMatchSet</code>
/// objects, and other predicates that identify the requests that you want to block. If
/// you add more than one predicate to a <code>Rule</code>, a request must match all of
/// the specifications to be allowed or blocked. For example, suppose that you add the
/// following to a <code>Rule</code>:
///
/// <ul> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44/32</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> </ul>
/// <para>
/// You then add the <code>Rule</code> to a <code>WebACL</code> and specify that you want
/// to blocks requests that satisfy the <code>Rule</code>. For a request to be blocked,
/// it must come from the IP address 192.0.2.44 <i>and</i> the <code>User-Agent</code>
/// header in the request must contain the value <code>BadBot</code>.
/// </para>
///
/// <para>
/// To create and configure a <code>Rule</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in the <code>Rule</code>.
/// For more information, see <a>CreateByteMatchSet</a>, <a>CreateIPSet</a>, and <a>CreateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRule</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRule</code> request to specify the predicates that you want
/// to include in the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>Rule</code>. For more
/// information, see <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateRule service method.</param>
///
/// <returns>The response from the CreateRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRule">REST API Reference for CreateRule Operation</seealso>
public virtual CreateRuleResponse CreateRule(CreateRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRuleResponseUnmarshaller.Instance;
return Invoke<CreateRuleResponse>(request, options);
}
/// <summary>
/// Creates a <code>Rule</code>, which contains the <code>IPSet</code> objects, <code>ByteMatchSet</code>
/// objects, and other predicates that identify the requests that you want to block. If
/// you add more than one predicate to a <code>Rule</code>, a request must match all of
/// the specifications to be allowed or blocked. For example, suppose that you add the
/// following to a <code>Rule</code>:
///
/// <ul> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44/32</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> </ul>
/// <para>
/// You then add the <code>Rule</code> to a <code>WebACL</code> and specify that you want
/// to blocks requests that satisfy the <code>Rule</code>. For a request to be blocked,
/// it must come from the IP address 192.0.2.44 <i>and</i> the <code>User-Agent</code>
/// header in the request must contain the value <code>BadBot</code>.
/// </para>
///
/// <para>
/// To create and configure a <code>Rule</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in the <code>Rule</code>.
/// For more information, see <a>CreateByteMatchSet</a>, <a>CreateIPSet</a>, and <a>CreateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRule</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRule</code> request to specify the predicates that you want
/// to include in the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>Rule</code>. For more
/// information, see <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description of the <a>Rule</a>. You can't change the name of a <code>Rule</code> after you create it.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="metricName">A friendly name or description for the metrics for this <code>Rule</code>. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can't contain white space. You can't change the name of the metric after you create the <code>Rule</code>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRule">REST API Reference for CreateRule Operation</seealso>
public virtual Task<CreateRuleResponse> CreateRuleAsync(string name, string changeToken, string metricName, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new CreateRuleRequest();
request.Name = name;
request.ChangeToken = changeToken;
request.MetricName = metricName;
return CreateRuleAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRule">REST API Reference for CreateRule Operation</seealso>
public virtual Task<CreateRuleResponse> CreateRuleAsync(CreateRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRuleResponseUnmarshaller.Instance;
return InvokeAsync<CreateRuleResponse>(request, options, cancellationToken);
}
#endregion
#region CreateRuleGroup
/// <summary>
/// Creates a <code>RuleGroup</code>. A rule group is a collection of predefined rules
/// that you add to a web ACL. You use <a>UpdateRuleGroup</a> to add rules to the rule
/// group.
///
///
/// <para>
/// Rule groups are subject to the following limits:
/// </para>
/// <ul> <li>
/// <para>
/// Three rule groups per account. You can request an increase to this limit by contacting
/// customer support.
/// </para>
/// </li> <li>
/// <para>
/// One rule group per web ACL.
/// </para>
/// </li> <li>
/// <para>
/// Ten rules per rule group.
/// </para>
/// </li> </ul>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateRuleGroup service method.</param>
///
/// <returns>The response from the CreateRuleGroup service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRuleGroup">REST API Reference for CreateRuleGroup Operation</seealso>
public virtual CreateRuleGroupResponse CreateRuleGroup(CreateRuleGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRuleGroupResponseUnmarshaller.Instance;
return Invoke<CreateRuleGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateRuleGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateRuleGroup operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRuleGroup">REST API Reference for CreateRuleGroup Operation</seealso>
public virtual Task<CreateRuleGroupResponse> CreateRuleGroupAsync(CreateRuleGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRuleGroupResponseUnmarshaller.Instance;
return InvokeAsync<CreateRuleGroupResponse>(request, options, cancellationToken);
}
#endregion
#region CreateSizeConstraintSet
/// <summary>
/// Creates a <code>SizeConstraintSet</code>. You then use <a>UpdateSizeConstraintSet</a>
/// to identify the part of a web request that you want AWS WAF to check for length, such
/// as the length of the <code>User-Agent</code> header or the length of the query string.
/// For example, you can create a <code>SizeConstraintSet</code> that matches any requests
/// that have a query string that is longer than 100 bytes. You can then configure AWS
/// WAF to reject those requests.
///
///
/// <para>
/// To create and configure a <code>SizeConstraintSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateSizeConstraintSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateSizeConstraintSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateSizeConstraintSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateSizeConstraintSet</a> request to specify the part of the request
/// that you want AWS WAF to inspect (for example, the header or the URI) and the value
/// that you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateSizeConstraintSet service method.</param>
///
/// <returns>The response from the CreateSizeConstraintSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSizeConstraintSet">REST API Reference for CreateSizeConstraintSet Operation</seealso>
public virtual CreateSizeConstraintSetResponse CreateSizeConstraintSet(CreateSizeConstraintSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateSizeConstraintSetResponseUnmarshaller.Instance;
return Invoke<CreateSizeConstraintSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateSizeConstraintSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateSizeConstraintSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSizeConstraintSet">REST API Reference for CreateSizeConstraintSet Operation</seealso>
public virtual Task<CreateSizeConstraintSetResponse> CreateSizeConstraintSetAsync(CreateSizeConstraintSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateSizeConstraintSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateSizeConstraintSetResponse>(request, options, cancellationToken);
}
#endregion
#region CreateSqlInjectionMatchSet
/// <summary>
/// Creates a <a>SqlInjectionMatchSet</a>, which you use to allow, block, or count requests
/// that contain snippets of SQL code in a specified part of web requests. AWS WAF searches
/// for character sequences that are likely to be malicious strings.
///
///
/// <para>
/// To create and configure a <code>SqlInjectionMatchSet</code>, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateSqlInjectionMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateSqlInjectionMatchSet</a> request to specify the parts of web requests
/// in which you want to allow, block, or count malicious SQL code.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description for the <a>SqlInjectionMatchSet</a> that you're creating. You can't change <code>Name</code> after you create the <code>SqlInjectionMatchSet</code>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the CreateSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSqlInjectionMatchSet">REST API Reference for CreateSqlInjectionMatchSet Operation</seealso>
public virtual CreateSqlInjectionMatchSetResponse CreateSqlInjectionMatchSet(string name, string changeToken)
{
var request = new CreateSqlInjectionMatchSetRequest();
request.Name = name;
request.ChangeToken = changeToken;
return CreateSqlInjectionMatchSet(request);
}
/// <summary>
/// Creates a <a>SqlInjectionMatchSet</a>, which you use to allow, block, or count requests
/// that contain snippets of SQL code in a specified part of web requests. AWS WAF searches
/// for character sequences that are likely to be malicious strings.
///
///
/// <para>
/// To create and configure a <code>SqlInjectionMatchSet</code>, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateSqlInjectionMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateSqlInjectionMatchSet</a> request to specify the parts of web requests
/// in which you want to allow, block, or count malicious SQL code.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateSqlInjectionMatchSet service method.</param>
///
/// <returns>The response from the CreateSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSqlInjectionMatchSet">REST API Reference for CreateSqlInjectionMatchSet Operation</seealso>
public virtual CreateSqlInjectionMatchSetResponse CreateSqlInjectionMatchSet(CreateSqlInjectionMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateSqlInjectionMatchSetResponseUnmarshaller.Instance;
return Invoke<CreateSqlInjectionMatchSetResponse>(request, options);
}
/// <summary>
/// Creates a <a>SqlInjectionMatchSet</a>, which you use to allow, block, or count requests
/// that contain snippets of SQL code in a specified part of web requests. AWS WAF searches
/// for character sequences that are likely to be malicious strings.
///
///
/// <para>
/// To create and configure a <code>SqlInjectionMatchSet</code>, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateSqlInjectionMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateSqlInjectionMatchSet</a> request to specify the parts of web requests
/// in which you want to allow, block, or count malicious SQL code.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="name">A friendly name or description for the <a>SqlInjectionMatchSet</a> that you're creating. You can't change <code>Name</code> after you create the <code>SqlInjectionMatchSet</code>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSqlInjectionMatchSet">REST API Reference for CreateSqlInjectionMatchSet Operation</seealso>
public virtual Task<CreateSqlInjectionMatchSetResponse> CreateSqlInjectionMatchSetAsync(string name, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new CreateSqlInjectionMatchSetRequest();
request.Name = name;
request.ChangeToken = changeToken;
return CreateSqlInjectionMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateSqlInjectionMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateSqlInjectionMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSqlInjectionMatchSet">REST API Reference for CreateSqlInjectionMatchSet Operation</seealso>
public virtual Task<CreateSqlInjectionMatchSetResponse> CreateSqlInjectionMatchSetAsync(CreateSqlInjectionMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateSqlInjectionMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateSqlInjectionMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region CreateWebACL
/// <summary>
/// Creates a <code>WebACL</code>, which contains the <code>Rules</code> that identify
/// the CloudFront web requests that you want to allow, block, or count. AWS WAF evaluates
/// <code>Rules</code> in order based on the value of <code>Priority</code> for each <code>Rule</code>.
///
///
/// <para>
/// You also specify a default action, either <code>ALLOW</code> or <code>BLOCK</code>.
/// If a web request doesn't match any of the <code>Rules</code> in a <code>WebACL</code>,
/// AWS WAF responds to the request with the default action.
/// </para>
///
/// <para>
/// To create and configure a <code>WebACL</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the <code>ByteMatchSet</code> objects and other predicates that
/// you want to include in <code>Rules</code>. For more information, see <a>CreateByteMatchSet</a>,
/// <a>UpdateByteMatchSet</a>, <a>CreateIPSet</a>, <a>UpdateIPSet</a>, <a>CreateSqlInjectionMatchSet</a>,
/// and <a>UpdateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update the <code>Rules</code> that you want to include in the <code>WebACL</code>.
/// For more information, see <a>CreateRule</a> and <a>UpdateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateWebACL</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateWebACL</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateWebACL</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateWebACL</a> request to specify the <code>Rules</code> that you want
/// to include in the <code>WebACL</code>, to specify the default action, and to associate
/// the <code>WebACL</code> with a CloudFront distribution.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS
/// WAF Developer Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateWebACL service method.</param>
///
/// <returns>The response from the CreateWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateWebACL">REST API Reference for CreateWebACL Operation</seealso>
public virtual CreateWebACLResponse CreateWebACL(CreateWebACLRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateWebACLResponseUnmarshaller.Instance;
return Invoke<CreateWebACLResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateWebACL operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateWebACL operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateWebACL">REST API Reference for CreateWebACL Operation</seealso>
public virtual Task<CreateWebACLResponse> CreateWebACLAsync(CreateWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateWebACLResponseUnmarshaller.Instance;
return InvokeAsync<CreateWebACLResponse>(request, options, cancellationToken);
}
#endregion
#region CreateXssMatchSet
/// <summary>
/// Creates an <a>XssMatchSet</a>, which you use to allow, block, or count requests that
/// contain cross-site scripting attacks in the specified part of web requests. AWS WAF
/// searches for character sequences that are likely to be malicious strings.
///
///
/// <para>
/// To create and configure an <code>XssMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>CreateXssMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>CreateXssMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateXssMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <a>UpdateXssMatchSet</a> request to specify the parts of web requests in
/// which you want to allow, block, or count cross-site scripting attacks.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateXssMatchSet service method.</param>
///
/// <returns>The response from the CreateXssMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateXssMatchSet">REST API Reference for CreateXssMatchSet Operation</seealso>
public virtual CreateXssMatchSetResponse CreateXssMatchSet(CreateXssMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateXssMatchSetResponseUnmarshaller.Instance;
return Invoke<CreateXssMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateXssMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateXssMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateXssMatchSet">REST API Reference for CreateXssMatchSet Operation</seealso>
public virtual Task<CreateXssMatchSetResponse> CreateXssMatchSetAsync(CreateXssMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateXssMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<CreateXssMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteByteMatchSet
/// <summary>
/// Permanently deletes a <a>ByteMatchSet</a>. You can't delete a <code>ByteMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still includes any <a>ByteMatchTuple</a>
/// objects (any filters).
///
///
/// <para>
/// If you just want to remove a <code>ByteMatchSet</code> from a <code>Rule</code>, use
/// <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>ByteMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateByteMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteByteMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="byteMatchSetId">The <code>ByteMatchSetId</code> of the <a>ByteMatchSet</a> that you want to delete. <code>ByteMatchSetId</code> is returned by <a>CreateByteMatchSet</a> and by <a>ListByteMatchSets</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the DeleteByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteByteMatchSet">REST API Reference for DeleteByteMatchSet Operation</seealso>
public virtual DeleteByteMatchSetResponse DeleteByteMatchSet(string byteMatchSetId, string changeToken)
{
var request = new DeleteByteMatchSetRequest();
request.ByteMatchSetId = byteMatchSetId;
request.ChangeToken = changeToken;
return DeleteByteMatchSet(request);
}
/// <summary>
/// Permanently deletes a <a>ByteMatchSet</a>. You can't delete a <code>ByteMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still includes any <a>ByteMatchTuple</a>
/// objects (any filters).
///
///
/// <para>
/// If you just want to remove a <code>ByteMatchSet</code> from a <code>Rule</code>, use
/// <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>ByteMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateByteMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteByteMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteByteMatchSet service method.</param>
///
/// <returns>The response from the DeleteByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteByteMatchSet">REST API Reference for DeleteByteMatchSet Operation</seealso>
public virtual DeleteByteMatchSetResponse DeleteByteMatchSet(DeleteByteMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteByteMatchSetResponseUnmarshaller.Instance;
return Invoke<DeleteByteMatchSetResponse>(request, options);
}
/// <summary>
/// Permanently deletes a <a>ByteMatchSet</a>. You can't delete a <code>ByteMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still includes any <a>ByteMatchTuple</a>
/// objects (any filters).
///
///
/// <para>
/// If you just want to remove a <code>ByteMatchSet</code> from a <code>Rule</code>, use
/// <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>ByteMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateByteMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteByteMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="byteMatchSetId">The <code>ByteMatchSetId</code> of the <a>ByteMatchSet</a> that you want to delete. <code>ByteMatchSetId</code> is returned by <a>CreateByteMatchSet</a> and by <a>ListByteMatchSets</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteByteMatchSet">REST API Reference for DeleteByteMatchSet Operation</seealso>
public virtual Task<DeleteByteMatchSetResponse> DeleteByteMatchSetAsync(string byteMatchSetId, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new DeleteByteMatchSetRequest();
request.ByteMatchSetId = byteMatchSetId;
request.ChangeToken = changeToken;
return DeleteByteMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteByteMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteByteMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteByteMatchSet">REST API Reference for DeleteByteMatchSet Operation</seealso>
public virtual Task<DeleteByteMatchSetResponse> DeleteByteMatchSetAsync(DeleteByteMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteByteMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteByteMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteGeoMatchSet
/// <summary>
/// Permanently deletes a <a>GeoMatchSet</a>. You can't delete a <code>GeoMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still includes any countries.
///
///
/// <para>
/// If you just want to remove a <code>GeoMatchSet</code> from a <code>Rule</code>, use
/// <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>GeoMatchSet</code> from AWS WAF, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>GeoMatchSet</code> to remove any countries. For more information,
/// see <a>UpdateGeoMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteGeoMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteGeoMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteGeoMatchSet service method.</param>
///
/// <returns>The response from the DeleteGeoMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteGeoMatchSet">REST API Reference for DeleteGeoMatchSet Operation</seealso>
public virtual DeleteGeoMatchSetResponse DeleteGeoMatchSet(DeleteGeoMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteGeoMatchSetResponseUnmarshaller.Instance;
return Invoke<DeleteGeoMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteGeoMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteGeoMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteGeoMatchSet">REST API Reference for DeleteGeoMatchSet Operation</seealso>
public virtual Task<DeleteGeoMatchSetResponse> DeleteGeoMatchSetAsync(DeleteGeoMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteGeoMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteGeoMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteIPSet
/// <summary>
/// Permanently deletes an <a>IPSet</a>. You can't delete an <code>IPSet</code> if it's
/// still used in any <code>Rules</code> or if it still includes any IP addresses.
///
///
/// <para>
/// If you just want to remove an <code>IPSet</code> from a <code>Rule</code>, use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete an <code>IPSet</code> from AWS WAF, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>IPSet</code> to remove IP address ranges, if any. For more information,
/// see <a>UpdateIPSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteIPSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="ipSetId">The <code>IPSetId</code> of the <a>IPSet</a> that you want to delete. <code>IPSetId</code> is returned by <a>CreateIPSet</a> and by <a>ListIPSets</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the DeleteIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteIPSet">REST API Reference for DeleteIPSet Operation</seealso>
public virtual DeleteIPSetResponse DeleteIPSet(string ipSetId, string changeToken)
{
var request = new DeleteIPSetRequest();
request.IPSetId = ipSetId;
request.ChangeToken = changeToken;
return DeleteIPSet(request);
}
/// <summary>
/// Permanently deletes an <a>IPSet</a>. You can't delete an <code>IPSet</code> if it's
/// still used in any <code>Rules</code> or if it still includes any IP addresses.
///
///
/// <para>
/// If you just want to remove an <code>IPSet</code> from a <code>Rule</code>, use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete an <code>IPSet</code> from AWS WAF, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>IPSet</code> to remove IP address ranges, if any. For more information,
/// see <a>UpdateIPSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteIPSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteIPSet service method.</param>
///
/// <returns>The response from the DeleteIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteIPSet">REST API Reference for DeleteIPSet Operation</seealso>
public virtual DeleteIPSetResponse DeleteIPSet(DeleteIPSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteIPSetResponseUnmarshaller.Instance;
return Invoke<DeleteIPSetResponse>(request, options);
}
/// <summary>
/// Permanently deletes an <a>IPSet</a>. You can't delete an <code>IPSet</code> if it's
/// still used in any <code>Rules</code> or if it still includes any IP addresses.
///
///
/// <para>
/// If you just want to remove an <code>IPSet</code> from a <code>Rule</code>, use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete an <code>IPSet</code> from AWS WAF, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>IPSet</code> to remove IP address ranges, if any. For more information,
/// see <a>UpdateIPSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteIPSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteIPSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="ipSetId">The <code>IPSetId</code> of the <a>IPSet</a> that you want to delete. <code>IPSetId</code> is returned by <a>CreateIPSet</a> and by <a>ListIPSets</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteIPSet">REST API Reference for DeleteIPSet Operation</seealso>
public virtual Task<DeleteIPSetResponse> DeleteIPSetAsync(string ipSetId, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new DeleteIPSetRequest();
request.IPSetId = ipSetId;
request.ChangeToken = changeToken;
return DeleteIPSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteIPSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteIPSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteIPSet">REST API Reference for DeleteIPSet Operation</seealso>
public virtual Task<DeleteIPSetResponse> DeleteIPSetAsync(DeleteIPSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteIPSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteIPSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteLoggingConfiguration
/// <summary>
/// Permanently deletes the <a>LoggingConfiguration</a> from the specified web ACL.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteLoggingConfiguration service method.</param>
///
/// <returns>The response from the DeleteLoggingConfiguration service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteLoggingConfiguration">REST API Reference for DeleteLoggingConfiguration Operation</seealso>
public virtual DeleteLoggingConfigurationResponse DeleteLoggingConfiguration(DeleteLoggingConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteLoggingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteLoggingConfigurationResponseUnmarshaller.Instance;
return Invoke<DeleteLoggingConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteLoggingConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteLoggingConfiguration operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteLoggingConfiguration">REST API Reference for DeleteLoggingConfiguration Operation</seealso>
public virtual Task<DeleteLoggingConfigurationResponse> DeleteLoggingConfigurationAsync(DeleteLoggingConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteLoggingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteLoggingConfigurationResponseUnmarshaller.Instance;
return InvokeAsync<DeleteLoggingConfigurationResponse>(request, options, cancellationToken);
}
#endregion
#region DeletePermissionPolicy
/// <summary>
/// Permanently deletes an IAM policy from the specified RuleGroup.
///
///
/// <para>
/// The user making the request must be the owner of the RuleGroup.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeletePermissionPolicy service method.</param>
///
/// <returns>The response from the DeletePermissionPolicy service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeletePermissionPolicy">REST API Reference for DeletePermissionPolicy Operation</seealso>
public virtual DeletePermissionPolicyResponse DeletePermissionPolicy(DeletePermissionPolicyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePermissionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePermissionPolicyResponseUnmarshaller.Instance;
return Invoke<DeletePermissionPolicyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeletePermissionPolicy operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeletePermissionPolicy operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeletePermissionPolicy">REST API Reference for DeletePermissionPolicy Operation</seealso>
public virtual Task<DeletePermissionPolicyResponse> DeletePermissionPolicyAsync(DeletePermissionPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePermissionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePermissionPolicyResponseUnmarshaller.Instance;
return InvokeAsync<DeletePermissionPolicyResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteRateBasedRule
/// <summary>
/// Permanently deletes a <a>RateBasedRule</a>. You can't delete a rule if it's still
/// used in any <code>WebACL</code> objects or if it still includes any predicates, such
/// as <code>ByteMatchSet</code> objects.
///
///
/// <para>
/// If you just want to remove a rule from a <code>WebACL</code>, use <a>UpdateWebACL</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>RateBasedRule</code> from AWS WAF, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>RateBasedRule</code> to remove predicates, if any. For more information,
/// see <a>UpdateRateBasedRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteRateBasedRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteRateBasedRule</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteRateBasedRule service method.</param>
///
/// <returns>The response from the DeleteRateBasedRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRateBasedRule">REST API Reference for DeleteRateBasedRule Operation</seealso>
public virtual DeleteRateBasedRuleResponse DeleteRateBasedRule(DeleteRateBasedRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRateBasedRuleResponseUnmarshaller.Instance;
return Invoke<DeleteRateBasedRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteRateBasedRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteRateBasedRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRateBasedRule">REST API Reference for DeleteRateBasedRule Operation</seealso>
public virtual Task<DeleteRateBasedRuleResponse> DeleteRateBasedRuleAsync(DeleteRateBasedRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRateBasedRuleResponseUnmarshaller.Instance;
return InvokeAsync<DeleteRateBasedRuleResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteRegexMatchSet
/// <summary>
/// Permanently deletes a <a>RegexMatchSet</a>. You can't delete a <code>RegexMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still includes any <code>RegexMatchTuples</code>
/// objects (any filters).
///
///
/// <para>
/// If you just want to remove a <code>RegexMatchSet</code> from a <code>Rule</code>,
/// use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>RegexMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>RegexMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateRegexMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteRegexMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteRegexMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteRegexMatchSet service method.</param>
///
/// <returns>The response from the DeleteRegexMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRegexMatchSet">REST API Reference for DeleteRegexMatchSet Operation</seealso>
public virtual DeleteRegexMatchSetResponse DeleteRegexMatchSet(DeleteRegexMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRegexMatchSetResponseUnmarshaller.Instance;
return Invoke<DeleteRegexMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteRegexMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteRegexMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRegexMatchSet">REST API Reference for DeleteRegexMatchSet Operation</seealso>
public virtual Task<DeleteRegexMatchSetResponse> DeleteRegexMatchSetAsync(DeleteRegexMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRegexMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteRegexMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteRegexPatternSet
/// <summary>
/// Permanently deletes a <a>RegexPatternSet</a>. You can't delete a <code>RegexPatternSet</code>
/// if it's still used in any <code>RegexMatchSet</code> or if the <code>RegexPatternSet</code>
/// is not empty.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteRegexPatternSet service method.</param>
///
/// <returns>The response from the DeleteRegexPatternSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRegexPatternSet">REST API Reference for DeleteRegexPatternSet Operation</seealso>
public virtual DeleteRegexPatternSetResponse DeleteRegexPatternSet(DeleteRegexPatternSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRegexPatternSetResponseUnmarshaller.Instance;
return Invoke<DeleteRegexPatternSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteRegexPatternSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteRegexPatternSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRegexPatternSet">REST API Reference for DeleteRegexPatternSet Operation</seealso>
public virtual Task<DeleteRegexPatternSetResponse> DeleteRegexPatternSetAsync(DeleteRegexPatternSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRegexPatternSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteRegexPatternSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteRule
/// <summary>
/// Permanently deletes a <a>Rule</a>. You can't delete a <code>Rule</code> if it's still
/// used in any <code>WebACL</code> objects or if it still includes any predicates, such
/// as <code>ByteMatchSet</code> objects.
///
///
/// <para>
/// If you just want to remove a <code>Rule</code> from a <code>WebACL</code>, use <a>UpdateWebACL</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>Rule</code> from AWS WAF, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>Rule</code> to remove predicates, if any. For more information, see
/// <a>UpdateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteRule</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="ruleId">The <code>RuleId</code> of the <a>Rule</a> that you want to delete. <code>RuleId</code> is returned by <a>CreateRule</a> and by <a>ListRules</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the DeleteRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRule">REST API Reference for DeleteRule Operation</seealso>
public virtual DeleteRuleResponse DeleteRule(string ruleId, string changeToken)
{
var request = new DeleteRuleRequest();
request.RuleId = ruleId;
request.ChangeToken = changeToken;
return DeleteRule(request);
}
/// <summary>
/// Permanently deletes a <a>Rule</a>. You can't delete a <code>Rule</code> if it's still
/// used in any <code>WebACL</code> objects or if it still includes any predicates, such
/// as <code>ByteMatchSet</code> objects.
///
///
/// <para>
/// If you just want to remove a <code>Rule</code> from a <code>WebACL</code>, use <a>UpdateWebACL</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>Rule</code> from AWS WAF, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>Rule</code> to remove predicates, if any. For more information, see
/// <a>UpdateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteRule</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteRule service method.</param>
///
/// <returns>The response from the DeleteRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRule">REST API Reference for DeleteRule Operation</seealso>
public virtual DeleteRuleResponse DeleteRule(DeleteRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleResponseUnmarshaller.Instance;
return Invoke<DeleteRuleResponse>(request, options);
}
/// <summary>
/// Permanently deletes a <a>Rule</a>. You can't delete a <code>Rule</code> if it's still
/// used in any <code>WebACL</code> objects or if it still includes any predicates, such
/// as <code>ByteMatchSet</code> objects.
///
///
/// <para>
/// If you just want to remove a <code>Rule</code> from a <code>WebACL</code>, use <a>UpdateWebACL</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>Rule</code> from AWS WAF, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>Rule</code> to remove predicates, if any. For more information, see
/// <a>UpdateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteRule</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteRule</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="ruleId">The <code>RuleId</code> of the <a>Rule</a> that you want to delete. <code>RuleId</code> is returned by <a>CreateRule</a> and by <a>ListRules</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRule">REST API Reference for DeleteRule Operation</seealso>
public virtual Task<DeleteRuleResponse> DeleteRuleAsync(string ruleId, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new DeleteRuleRequest();
request.RuleId = ruleId;
request.ChangeToken = changeToken;
return DeleteRuleAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRule">REST API Reference for DeleteRule Operation</seealso>
public virtual Task<DeleteRuleResponse> DeleteRuleAsync(DeleteRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleResponseUnmarshaller.Instance;
return InvokeAsync<DeleteRuleResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteRuleGroup
/// <summary>
/// Permanently deletes a <a>RuleGroup</a>. You can't delete a <code>RuleGroup</code>
/// if it's still used in any <code>WebACL</code> objects or if it still includes any
/// rules.
///
///
/// <para>
/// If you just want to remove a <code>RuleGroup</code> from a <code>WebACL</code>, use
/// <a>UpdateWebACL</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>RuleGroup</code> from AWS WAF, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>RuleGroup</code> to remove rules, if any. For more information, see
/// <a>UpdateRuleGroup</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteRuleGroup</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteRuleGroup</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteRuleGroup service method.</param>
///
/// <returns>The response from the DeleteRuleGroup service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRuleGroup">REST API Reference for DeleteRuleGroup Operation</seealso>
public virtual DeleteRuleGroupResponse DeleteRuleGroup(DeleteRuleGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleGroupResponseUnmarshaller.Instance;
return Invoke<DeleteRuleGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteRuleGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteRuleGroup operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRuleGroup">REST API Reference for DeleteRuleGroup Operation</seealso>
public virtual Task<DeleteRuleGroupResponse> DeleteRuleGroupAsync(DeleteRuleGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleGroupResponseUnmarshaller.Instance;
return InvokeAsync<DeleteRuleGroupResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteSizeConstraintSet
/// <summary>
/// Permanently deletes a <a>SizeConstraintSet</a>. You can't delete a <code>SizeConstraintSet</code>
/// if it's still used in any <code>Rules</code> or if it still includes any <a>SizeConstraint</a>
/// objects (any filters).
///
///
/// <para>
/// If you just want to remove a <code>SizeConstraintSet</code> from a <code>Rule</code>,
/// use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>SizeConstraintSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>SizeConstraintSet</code> to remove filters, if any. For more information,
/// see <a>UpdateSizeConstraintSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteSizeConstraintSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteSizeConstraintSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteSizeConstraintSet service method.</param>
///
/// <returns>The response from the DeleteSizeConstraintSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSizeConstraintSet">REST API Reference for DeleteSizeConstraintSet Operation</seealso>
public virtual DeleteSizeConstraintSetResponse DeleteSizeConstraintSet(DeleteSizeConstraintSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteSizeConstraintSetResponseUnmarshaller.Instance;
return Invoke<DeleteSizeConstraintSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteSizeConstraintSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteSizeConstraintSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSizeConstraintSet">REST API Reference for DeleteSizeConstraintSet Operation</seealso>
public virtual Task<DeleteSizeConstraintSetResponse> DeleteSizeConstraintSetAsync(DeleteSizeConstraintSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteSizeConstraintSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteSizeConstraintSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteSqlInjectionMatchSet
/// <summary>
/// Permanently deletes a <a>SqlInjectionMatchSet</a>. You can't delete a <code>SqlInjectionMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still contains any <a>SqlInjectionMatchTuple</a>
/// objects.
///
///
/// <para>
/// If you just want to remove a <code>SqlInjectionMatchSet</code> from a <code>Rule</code>,
/// use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>SqlInjectionMatchSet</code> from AWS WAF, perform the
/// following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>SqlInjectionMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteSqlInjectionMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="sqlInjectionMatchSetId">The <code>SqlInjectionMatchSetId</code> of the <a>SqlInjectionMatchSet</a> that you want to delete. <code>SqlInjectionMatchSetId</code> is returned by <a>CreateSqlInjectionMatchSet</a> and by <a>ListSqlInjectionMatchSets</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the DeleteSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSqlInjectionMatchSet">REST API Reference for DeleteSqlInjectionMatchSet Operation</seealso>
public virtual DeleteSqlInjectionMatchSetResponse DeleteSqlInjectionMatchSet(string sqlInjectionMatchSetId, string changeToken)
{
var request = new DeleteSqlInjectionMatchSetRequest();
request.SqlInjectionMatchSetId = sqlInjectionMatchSetId;
request.ChangeToken = changeToken;
return DeleteSqlInjectionMatchSet(request);
}
/// <summary>
/// Permanently deletes a <a>SqlInjectionMatchSet</a>. You can't delete a <code>SqlInjectionMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still contains any <a>SqlInjectionMatchTuple</a>
/// objects.
///
///
/// <para>
/// If you just want to remove a <code>SqlInjectionMatchSet</code> from a <code>Rule</code>,
/// use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>SqlInjectionMatchSet</code> from AWS WAF, perform the
/// following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>SqlInjectionMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteSqlInjectionMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteSqlInjectionMatchSet service method.</param>
///
/// <returns>The response from the DeleteSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSqlInjectionMatchSet">REST API Reference for DeleteSqlInjectionMatchSet Operation</seealso>
public virtual DeleteSqlInjectionMatchSetResponse DeleteSqlInjectionMatchSet(DeleteSqlInjectionMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteSqlInjectionMatchSetResponseUnmarshaller.Instance;
return Invoke<DeleteSqlInjectionMatchSetResponse>(request, options);
}
/// <summary>
/// Permanently deletes a <a>SqlInjectionMatchSet</a>. You can't delete a <code>SqlInjectionMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still contains any <a>SqlInjectionMatchTuple</a>
/// objects.
///
///
/// <para>
/// If you just want to remove a <code>SqlInjectionMatchSet</code> from a <code>Rule</code>,
/// use <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete a <code>SqlInjectionMatchSet</code> from AWS WAF, perform the
/// following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>SqlInjectionMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteSqlInjectionMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteSqlInjectionMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="sqlInjectionMatchSetId">The <code>SqlInjectionMatchSetId</code> of the <a>SqlInjectionMatchSet</a> that you want to delete. <code>SqlInjectionMatchSetId</code> is returned by <a>CreateSqlInjectionMatchSet</a> and by <a>ListSqlInjectionMatchSets</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSqlInjectionMatchSet">REST API Reference for DeleteSqlInjectionMatchSet Operation</seealso>
public virtual Task<DeleteSqlInjectionMatchSetResponse> DeleteSqlInjectionMatchSetAsync(string sqlInjectionMatchSetId, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new DeleteSqlInjectionMatchSetRequest();
request.SqlInjectionMatchSetId = sqlInjectionMatchSetId;
request.ChangeToken = changeToken;
return DeleteSqlInjectionMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteSqlInjectionMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteSqlInjectionMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSqlInjectionMatchSet">REST API Reference for DeleteSqlInjectionMatchSet Operation</seealso>
public virtual Task<DeleteSqlInjectionMatchSetResponse> DeleteSqlInjectionMatchSetAsync(DeleteSqlInjectionMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteSqlInjectionMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteSqlInjectionMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteWebACL
/// <summary>
/// Permanently deletes a <a>WebACL</a>. You can't delete a <code>WebACL</code> if it
/// still contains any <code>Rules</code>.
///
///
/// <para>
/// To delete a <code>WebACL</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>WebACL</code> to remove <code>Rules</code>, if any. For more information,
/// see <a>UpdateWebACL</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteWebACL</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteWebACL</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="webACLId">The <code>WebACLId</code> of the <a>WebACL</a> that you want to delete. <code>WebACLId</code> is returned by <a>CreateWebACL</a> and by <a>ListWebACLs</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the DeleteWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteWebACL">REST API Reference for DeleteWebACL Operation</seealso>
public virtual DeleteWebACLResponse DeleteWebACL(string webACLId, string changeToken)
{
var request = new DeleteWebACLRequest();
request.WebACLId = webACLId;
request.ChangeToken = changeToken;
return DeleteWebACL(request);
}
/// <summary>
/// Permanently deletes a <a>WebACL</a>. You can't delete a <code>WebACL</code> if it
/// still contains any <code>Rules</code>.
///
///
/// <para>
/// To delete a <code>WebACL</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>WebACL</code> to remove <code>Rules</code>, if any. For more information,
/// see <a>UpdateWebACL</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteWebACL</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteWebACL</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteWebACL service method.</param>
///
/// <returns>The response from the DeleteWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteWebACL">REST API Reference for DeleteWebACL Operation</seealso>
public virtual DeleteWebACLResponse DeleteWebACL(DeleteWebACLRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteWebACLResponseUnmarshaller.Instance;
return Invoke<DeleteWebACLResponse>(request, options);
}
/// <summary>
/// Permanently deletes a <a>WebACL</a>. You can't delete a <code>WebACL</code> if it
/// still contains any <code>Rules</code>.
///
///
/// <para>
/// To delete a <code>WebACL</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>WebACL</code> to remove <code>Rules</code>, if any. For more information,
/// see <a>UpdateWebACL</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteWebACL</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteWebACL</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="webACLId">The <code>WebACLId</code> of the <a>WebACL</a> that you want to delete. <code>WebACLId</code> is returned by <a>CreateWebACL</a> and by <a>ListWebACLs</a>.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteWebACL">REST API Reference for DeleteWebACL Operation</seealso>
public virtual Task<DeleteWebACLResponse> DeleteWebACLAsync(string webACLId, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new DeleteWebACLRequest();
request.WebACLId = webACLId;
request.ChangeToken = changeToken;
return DeleteWebACLAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteWebACL operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteWebACL operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteWebACL">REST API Reference for DeleteWebACL Operation</seealso>
public virtual Task<DeleteWebACLResponse> DeleteWebACLAsync(DeleteWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteWebACLResponseUnmarshaller.Instance;
return InvokeAsync<DeleteWebACLResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteXssMatchSet
/// <summary>
/// Permanently deletes an <a>XssMatchSet</a>. You can't delete an <code>XssMatchSet</code>
/// if it's still used in any <code>Rules</code> or if it still contains any <a>XssMatchTuple</a>
/// objects.
///
///
/// <para>
/// If you just want to remove an <code>XssMatchSet</code> from a <code>Rule</code>, use
/// <a>UpdateRule</a>.
/// </para>
///
/// <para>
/// To permanently delete an <code>XssMatchSet</code> from AWS WAF, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Update the <code>XssMatchSet</code> to remove filters, if any. For more information,
/// see <a>UpdateXssMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of a <code>DeleteXssMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit a <code>DeleteXssMatchSet</code> request.
/// </para>
/// </li> </ol>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteXssMatchSet service method.</param>
///
/// <returns>The response from the DeleteXssMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonEmptyEntityException">
/// The operation failed because you tried to delete an object that isn't empty. For example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>WebACL</code> that still contains one or more <code>Rule</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that still contains one or more <code>ByteMatchSet</code>
/// objects or other predicates.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that contains one or more <code>ByteMatchTuple</code>
/// objects.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete an <code>IPSet</code> that references one or more IP addresses.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteXssMatchSet">REST API Reference for DeleteXssMatchSet Operation</seealso>
public virtual DeleteXssMatchSetResponse DeleteXssMatchSet(DeleteXssMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteXssMatchSetResponseUnmarshaller.Instance;
return Invoke<DeleteXssMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteXssMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteXssMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteXssMatchSet">REST API Reference for DeleteXssMatchSet Operation</seealso>
public virtual Task<DeleteXssMatchSetResponse> DeleteXssMatchSetAsync(DeleteXssMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteXssMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<DeleteXssMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetByteMatchSet
/// <summary>
/// Returns the <a>ByteMatchSet</a> specified by <code>ByteMatchSetId</code>.
/// </summary>
/// <param name="byteMatchSetId">The <code>ByteMatchSetId</code> of the <a>ByteMatchSet</a> that you want to get. <code>ByteMatchSetId</code> is returned by <a>CreateByteMatchSet</a> and by <a>ListByteMatchSets</a>.</param>
///
/// <returns>The response from the GetByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetByteMatchSet">REST API Reference for GetByteMatchSet Operation</seealso>
public virtual GetByteMatchSetResponse GetByteMatchSet(string byteMatchSetId)
{
var request = new GetByteMatchSetRequest();
request.ByteMatchSetId = byteMatchSetId;
return GetByteMatchSet(request);
}
/// <summary>
/// Returns the <a>ByteMatchSet</a> specified by <code>ByteMatchSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetByteMatchSet service method.</param>
///
/// <returns>The response from the GetByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetByteMatchSet">REST API Reference for GetByteMatchSet Operation</seealso>
public virtual GetByteMatchSetResponse GetByteMatchSet(GetByteMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetByteMatchSetResponseUnmarshaller.Instance;
return Invoke<GetByteMatchSetResponse>(request, options);
}
/// <summary>
/// Returns the <a>ByteMatchSet</a> specified by <code>ByteMatchSetId</code>.
/// </summary>
/// <param name="byteMatchSetId">The <code>ByteMatchSetId</code> of the <a>ByteMatchSet</a> that you want to get. <code>ByteMatchSetId</code> is returned by <a>CreateByteMatchSet</a> and by <a>ListByteMatchSets</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetByteMatchSet">REST API Reference for GetByteMatchSet Operation</seealso>
public virtual Task<GetByteMatchSetResponse> GetByteMatchSetAsync(string byteMatchSetId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new GetByteMatchSetRequest();
request.ByteMatchSetId = byteMatchSetId;
return GetByteMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the GetByteMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetByteMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetByteMatchSet">REST API Reference for GetByteMatchSet Operation</seealso>
public virtual Task<GetByteMatchSetResponse> GetByteMatchSetAsync(GetByteMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetByteMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<GetByteMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetChangeToken
/// <summary>
/// When you want to create, update, or delete AWS WAF objects, get a change token and
/// include the change token in the create, update, or delete request. Change tokens ensure
/// that your application doesn't submit conflicting requests to AWS WAF.
///
///
/// <para>
/// Each create, update, or delete request must use a unique change token. If your application
/// submits a <code>GetChangeToken</code> request and then submits a second <code>GetChangeToken</code>
/// request before submitting a create, update, or delete request, the second <code>GetChangeToken</code>
/// request returns the same value as the first <code>GetChangeToken</code> request.
/// </para>
///
/// <para>
/// When you use a change token in a create, update, or delete request, the status of
/// the change token changes to <code>PENDING</code>, which indicates that AWS WAF is
/// propagating the change to all AWS WAF servers. Use <code>GetChangeTokenStatus</code>
/// to determine the status of your change token.
/// </para>
/// </summary>
///
/// <returns>The response from the GetChangeToken service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeToken">REST API Reference for GetChangeToken Operation</seealso>
public virtual GetChangeTokenResponse GetChangeToken()
{
return GetChangeToken(new GetChangeTokenRequest());
}
/// <summary>
/// When you want to create, update, or delete AWS WAF objects, get a change token and
/// include the change token in the create, update, or delete request. Change tokens ensure
/// that your application doesn't submit conflicting requests to AWS WAF.
///
///
/// <para>
/// Each create, update, or delete request must use a unique change token. If your application
/// submits a <code>GetChangeToken</code> request and then submits a second <code>GetChangeToken</code>
/// request before submitting a create, update, or delete request, the second <code>GetChangeToken</code>
/// request returns the same value as the first <code>GetChangeToken</code> request.
/// </para>
///
/// <para>
/// When you use a change token in a create, update, or delete request, the status of
/// the change token changes to <code>PENDING</code>, which indicates that AWS WAF is
/// propagating the change to all AWS WAF servers. Use <code>GetChangeTokenStatus</code>
/// to determine the status of your change token.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetChangeToken service method.</param>
///
/// <returns>The response from the GetChangeToken service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeToken">REST API Reference for GetChangeToken Operation</seealso>
public virtual GetChangeTokenResponse GetChangeToken(GetChangeTokenRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetChangeTokenRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetChangeTokenResponseUnmarshaller.Instance;
return Invoke<GetChangeTokenResponse>(request, options);
}
/// <summary>
/// When you want to create, update, or delete AWS WAF objects, get a change token and
/// include the change token in the create, update, or delete request. Change tokens ensure
/// that your application doesn't submit conflicting requests to AWS WAF.
///
///
/// <para>
/// Each create, update, or delete request must use a unique change token. If your application
/// submits a <code>GetChangeToken</code> request and then submits a second <code>GetChangeToken</code>
/// request before submitting a create, update, or delete request, the second <code>GetChangeToken</code>
/// request returns the same value as the first <code>GetChangeToken</code> request.
/// </para>
///
/// <para>
/// When you use a change token in a create, update, or delete request, the status of
/// the change token changes to <code>PENDING</code>, which indicates that AWS WAF is
/// propagating the change to all AWS WAF servers. Use <code>GetChangeTokenStatus</code>
/// to determine the status of your change token.
/// </para>
/// </summary>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetChangeToken service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeToken">REST API Reference for GetChangeToken Operation</seealso>
public virtual Task<GetChangeTokenResponse> GetChangeTokenAsync(System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
return GetChangeTokenAsync(new GetChangeTokenRequest(), cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the GetChangeToken operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetChangeToken operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeToken">REST API Reference for GetChangeToken Operation</seealso>
public virtual Task<GetChangeTokenResponse> GetChangeTokenAsync(GetChangeTokenRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetChangeTokenRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetChangeTokenResponseUnmarshaller.Instance;
return InvokeAsync<GetChangeTokenResponse>(request, options, cancellationToken);
}
#endregion
#region GetChangeTokenStatus
/// <summary>
/// Returns the status of a <code>ChangeToken</code> that you got by calling <a>GetChangeToken</a>.
/// <code>ChangeTokenStatus</code> is one of the following values:
///
/// <ul> <li>
/// <para>
/// <code>PROVISIONED</code>: You requested the change token by calling <code>GetChangeToken</code>,
/// but you haven't used it yet in a call to create, update, or delete an AWS WAF object.
/// </para>
/// </li> <li>
/// <para>
/// <code>PENDING</code>: AWS WAF is propagating the create, update, or delete request
/// to all AWS WAF servers.
/// </para>
/// </li> <li>
/// <para>
/// <code>INSYNC</code>: Propagation is complete.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="changeToken">The change token for which you want to get the status. This change token was previously returned in the <code>GetChangeToken</code> response.</param>
///
/// <returns>The response from the GetChangeTokenStatus service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeTokenStatus">REST API Reference for GetChangeTokenStatus Operation</seealso>
public virtual GetChangeTokenStatusResponse GetChangeTokenStatus(string changeToken)
{
var request = new GetChangeTokenStatusRequest();
request.ChangeToken = changeToken;
return GetChangeTokenStatus(request);
}
/// <summary>
/// Returns the status of a <code>ChangeToken</code> that you got by calling <a>GetChangeToken</a>.
/// <code>ChangeTokenStatus</code> is one of the following values:
///
/// <ul> <li>
/// <para>
/// <code>PROVISIONED</code>: You requested the change token by calling <code>GetChangeToken</code>,
/// but you haven't used it yet in a call to create, update, or delete an AWS WAF object.
/// </para>
/// </li> <li>
/// <para>
/// <code>PENDING</code>: AWS WAF is propagating the create, update, or delete request
/// to all AWS WAF servers.
/// </para>
/// </li> <li>
/// <para>
/// <code>INSYNC</code>: Propagation is complete.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetChangeTokenStatus service method.</param>
///
/// <returns>The response from the GetChangeTokenStatus service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeTokenStatus">REST API Reference for GetChangeTokenStatus Operation</seealso>
public virtual GetChangeTokenStatusResponse GetChangeTokenStatus(GetChangeTokenStatusRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetChangeTokenStatusRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetChangeTokenStatusResponseUnmarshaller.Instance;
return Invoke<GetChangeTokenStatusResponse>(request, options);
}
/// <summary>
/// Returns the status of a <code>ChangeToken</code> that you got by calling <a>GetChangeToken</a>.
/// <code>ChangeTokenStatus</code> is one of the following values:
///
/// <ul> <li>
/// <para>
/// <code>PROVISIONED</code>: You requested the change token by calling <code>GetChangeToken</code>,
/// but you haven't used it yet in a call to create, update, or delete an AWS WAF object.
/// </para>
/// </li> <li>
/// <para>
/// <code>PENDING</code>: AWS WAF is propagating the create, update, or delete request
/// to all AWS WAF servers.
/// </para>
/// </li> <li>
/// <para>
/// <code>INSYNC</code>: Propagation is complete.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="changeToken">The change token for which you want to get the status. This change token was previously returned in the <code>GetChangeToken</code> response.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetChangeTokenStatus service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeTokenStatus">REST API Reference for GetChangeTokenStatus Operation</seealso>
public virtual Task<GetChangeTokenStatusResponse> GetChangeTokenStatusAsync(string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new GetChangeTokenStatusRequest();
request.ChangeToken = changeToken;
return GetChangeTokenStatusAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the GetChangeTokenStatus operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetChangeTokenStatus operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeTokenStatus">REST API Reference for GetChangeTokenStatus Operation</seealso>
public virtual Task<GetChangeTokenStatusResponse> GetChangeTokenStatusAsync(GetChangeTokenStatusRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetChangeTokenStatusRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetChangeTokenStatusResponseUnmarshaller.Instance;
return InvokeAsync<GetChangeTokenStatusResponse>(request, options, cancellationToken);
}
#endregion
#region GetGeoMatchSet
/// <summary>
/// Returns the <a>GeoMatchSet</a> that is specified by <code>GeoMatchSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetGeoMatchSet service method.</param>
///
/// <returns>The response from the GetGeoMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetGeoMatchSet">REST API Reference for GetGeoMatchSet Operation</seealso>
public virtual GetGeoMatchSetResponse GetGeoMatchSet(GetGeoMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetGeoMatchSetResponseUnmarshaller.Instance;
return Invoke<GetGeoMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetGeoMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetGeoMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetGeoMatchSet">REST API Reference for GetGeoMatchSet Operation</seealso>
public virtual Task<GetGeoMatchSetResponse> GetGeoMatchSetAsync(GetGeoMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetGeoMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<GetGeoMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetIPSet
/// <summary>
/// Returns the <a>IPSet</a> that is specified by <code>IPSetId</code>.
/// </summary>
/// <param name="ipSetId">The <code>IPSetId</code> of the <a>IPSet</a> that you want to get. <code>IPSetId</code> is returned by <a>CreateIPSet</a> and by <a>ListIPSets</a>.</param>
///
/// <returns>The response from the GetIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetIPSet">REST API Reference for GetIPSet Operation</seealso>
public virtual GetIPSetResponse GetIPSet(string ipSetId)
{
var request = new GetIPSetRequest();
request.IPSetId = ipSetId;
return GetIPSet(request);
}
/// <summary>
/// Returns the <a>IPSet</a> that is specified by <code>IPSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetIPSet service method.</param>
///
/// <returns>The response from the GetIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetIPSet">REST API Reference for GetIPSet Operation</seealso>
public virtual GetIPSetResponse GetIPSet(GetIPSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetIPSetResponseUnmarshaller.Instance;
return Invoke<GetIPSetResponse>(request, options);
}
/// <summary>
/// Returns the <a>IPSet</a> that is specified by <code>IPSetId</code>.
/// </summary>
/// <param name="ipSetId">The <code>IPSetId</code> of the <a>IPSet</a> that you want to get. <code>IPSetId</code> is returned by <a>CreateIPSet</a> and by <a>ListIPSets</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetIPSet">REST API Reference for GetIPSet Operation</seealso>
public virtual Task<GetIPSetResponse> GetIPSetAsync(string ipSetId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new GetIPSetRequest();
request.IPSetId = ipSetId;
return GetIPSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the GetIPSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetIPSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetIPSet">REST API Reference for GetIPSet Operation</seealso>
public virtual Task<GetIPSetResponse> GetIPSetAsync(GetIPSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetIPSetResponseUnmarshaller.Instance;
return InvokeAsync<GetIPSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetLoggingConfiguration
/// <summary>
/// Returns the <a>LoggingConfiguration</a> for the specified web ACL.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetLoggingConfiguration service method.</param>
///
/// <returns>The response from the GetLoggingConfiguration service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetLoggingConfiguration">REST API Reference for GetLoggingConfiguration Operation</seealso>
public virtual GetLoggingConfigurationResponse GetLoggingConfiguration(GetLoggingConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLoggingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLoggingConfigurationResponseUnmarshaller.Instance;
return Invoke<GetLoggingConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetLoggingConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetLoggingConfiguration operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetLoggingConfiguration">REST API Reference for GetLoggingConfiguration Operation</seealso>
public virtual Task<GetLoggingConfigurationResponse> GetLoggingConfigurationAsync(GetLoggingConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLoggingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLoggingConfigurationResponseUnmarshaller.Instance;
return InvokeAsync<GetLoggingConfigurationResponse>(request, options, cancellationToken);
}
#endregion
#region GetPermissionPolicy
/// <summary>
/// Returns the IAM policy attached to the RuleGroup.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetPermissionPolicy service method.</param>
///
/// <returns>The response from the GetPermissionPolicy service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetPermissionPolicy">REST API Reference for GetPermissionPolicy Operation</seealso>
public virtual GetPermissionPolicyResponse GetPermissionPolicy(GetPermissionPolicyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetPermissionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetPermissionPolicyResponseUnmarshaller.Instance;
return Invoke<GetPermissionPolicyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetPermissionPolicy operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetPermissionPolicy operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetPermissionPolicy">REST API Reference for GetPermissionPolicy Operation</seealso>
public virtual Task<GetPermissionPolicyResponse> GetPermissionPolicyAsync(GetPermissionPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetPermissionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetPermissionPolicyResponseUnmarshaller.Instance;
return InvokeAsync<GetPermissionPolicyResponse>(request, options, cancellationToken);
}
#endregion
#region GetRateBasedRule
/// <summary>
/// Returns the <a>RateBasedRule</a> that is specified by the <code>RuleId</code> that
/// you included in the <code>GetRateBasedRule</code> request.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetRateBasedRule service method.</param>
///
/// <returns>The response from the GetRateBasedRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRateBasedRule">REST API Reference for GetRateBasedRule Operation</seealso>
public virtual GetRateBasedRuleResponse GetRateBasedRule(GetRateBasedRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRateBasedRuleResponseUnmarshaller.Instance;
return Invoke<GetRateBasedRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetRateBasedRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetRateBasedRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRateBasedRule">REST API Reference for GetRateBasedRule Operation</seealso>
public virtual Task<GetRateBasedRuleResponse> GetRateBasedRuleAsync(GetRateBasedRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRateBasedRuleResponseUnmarshaller.Instance;
return InvokeAsync<GetRateBasedRuleResponse>(request, options, cancellationToken);
}
#endregion
#region GetRateBasedRuleManagedKeys
/// <summary>
/// Returns an array of IP addresses currently being blocked by the <a>RateBasedRule</a>
/// that is specified by the <code>RuleId</code>. The maximum number of managed keys that
/// will be blocked is 10,000. If more than 10,000 addresses exceed the rate limit, the
/// 10,000 addresses with the highest rates will be blocked.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetRateBasedRuleManagedKeys service method.</param>
///
/// <returns>The response from the GetRateBasedRuleManagedKeys service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRateBasedRuleManagedKeys">REST API Reference for GetRateBasedRuleManagedKeys Operation</seealso>
public virtual GetRateBasedRuleManagedKeysResponse GetRateBasedRuleManagedKeys(GetRateBasedRuleManagedKeysRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRateBasedRuleManagedKeysRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRateBasedRuleManagedKeysResponseUnmarshaller.Instance;
return Invoke<GetRateBasedRuleManagedKeysResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetRateBasedRuleManagedKeys operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetRateBasedRuleManagedKeys operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRateBasedRuleManagedKeys">REST API Reference for GetRateBasedRuleManagedKeys Operation</seealso>
public virtual Task<GetRateBasedRuleManagedKeysResponse> GetRateBasedRuleManagedKeysAsync(GetRateBasedRuleManagedKeysRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRateBasedRuleManagedKeysRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRateBasedRuleManagedKeysResponseUnmarshaller.Instance;
return InvokeAsync<GetRateBasedRuleManagedKeysResponse>(request, options, cancellationToken);
}
#endregion
#region GetRegexMatchSet
/// <summary>
/// Returns the <a>RegexMatchSet</a> specified by <code>RegexMatchSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetRegexMatchSet service method.</param>
///
/// <returns>The response from the GetRegexMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRegexMatchSet">REST API Reference for GetRegexMatchSet Operation</seealso>
public virtual GetRegexMatchSetResponse GetRegexMatchSet(GetRegexMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRegexMatchSetResponseUnmarshaller.Instance;
return Invoke<GetRegexMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetRegexMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetRegexMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRegexMatchSet">REST API Reference for GetRegexMatchSet Operation</seealso>
public virtual Task<GetRegexMatchSetResponse> GetRegexMatchSetAsync(GetRegexMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRegexMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<GetRegexMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetRegexPatternSet
/// <summary>
/// Returns the <a>RegexPatternSet</a> specified by <code>RegexPatternSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetRegexPatternSet service method.</param>
///
/// <returns>The response from the GetRegexPatternSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRegexPatternSet">REST API Reference for GetRegexPatternSet Operation</seealso>
public virtual GetRegexPatternSetResponse GetRegexPatternSet(GetRegexPatternSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRegexPatternSetResponseUnmarshaller.Instance;
return Invoke<GetRegexPatternSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetRegexPatternSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetRegexPatternSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRegexPatternSet">REST API Reference for GetRegexPatternSet Operation</seealso>
public virtual Task<GetRegexPatternSetResponse> GetRegexPatternSetAsync(GetRegexPatternSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRegexPatternSetResponseUnmarshaller.Instance;
return InvokeAsync<GetRegexPatternSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetRule
/// <summary>
/// Returns the <a>Rule</a> that is specified by the <code>RuleId</code> that you included
/// in the <code>GetRule</code> request.
/// </summary>
/// <param name="ruleId">The <code>RuleId</code> of the <a>Rule</a> that you want to get. <code>RuleId</code> is returned by <a>CreateRule</a> and by <a>ListRules</a>.</param>
///
/// <returns>The response from the GetRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRule">REST API Reference for GetRule Operation</seealso>
public virtual GetRuleResponse GetRule(string ruleId)
{
var request = new GetRuleRequest();
request.RuleId = ruleId;
return GetRule(request);
}
/// <summary>
/// Returns the <a>Rule</a> that is specified by the <code>RuleId</code> that you included
/// in the <code>GetRule</code> request.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetRule service method.</param>
///
/// <returns>The response from the GetRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRule">REST API Reference for GetRule Operation</seealso>
public virtual GetRuleResponse GetRule(GetRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRuleResponseUnmarshaller.Instance;
return Invoke<GetRuleResponse>(request, options);
}
/// <summary>
/// Returns the <a>Rule</a> that is specified by the <code>RuleId</code> that you included
/// in the <code>GetRule</code> request.
/// </summary>
/// <param name="ruleId">The <code>RuleId</code> of the <a>Rule</a> that you want to get. <code>RuleId</code> is returned by <a>CreateRule</a> and by <a>ListRules</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRule">REST API Reference for GetRule Operation</seealso>
public virtual Task<GetRuleResponse> GetRuleAsync(string ruleId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new GetRuleRequest();
request.RuleId = ruleId;
return GetRuleAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the GetRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRule">REST API Reference for GetRule Operation</seealso>
public virtual Task<GetRuleResponse> GetRuleAsync(GetRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRuleResponseUnmarshaller.Instance;
return InvokeAsync<GetRuleResponse>(request, options, cancellationToken);
}
#endregion
#region GetRuleGroup
/// <summary>
/// Returns the <a>RuleGroup</a> that is specified by the <code>RuleGroupId</code> that
/// you included in the <code>GetRuleGroup</code> request.
///
///
/// <para>
/// To view the rules in a rule group, use <a>ListActivatedRulesInRuleGroup</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetRuleGroup service method.</param>
///
/// <returns>The response from the GetRuleGroup service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRuleGroup">REST API Reference for GetRuleGroup Operation</seealso>
public virtual GetRuleGroupResponse GetRuleGroup(GetRuleGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRuleGroupResponseUnmarshaller.Instance;
return Invoke<GetRuleGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetRuleGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetRuleGroup operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRuleGroup">REST API Reference for GetRuleGroup Operation</seealso>
public virtual Task<GetRuleGroupResponse> GetRuleGroupAsync(GetRuleGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRuleGroupResponseUnmarshaller.Instance;
return InvokeAsync<GetRuleGroupResponse>(request, options, cancellationToken);
}
#endregion
#region GetSampledRequests
/// <summary>
/// Gets detailed information about a specified number of requests--a sample--that AWS
/// WAF randomly selects from among the first 5,000 requests that your AWS resource received
/// during a time range that you choose. You can specify a sample size of up to 500 requests,
/// and you can specify any time range in the previous three hours.
///
///
/// <para>
/// <code>GetSampledRequests</code> returns a time range, which is usually the time range
/// that you specified. However, if your resource (such as a CloudFront distribution)
/// received 5,000 requests before the specified time range elapsed, <code>GetSampledRequests</code>
/// returns an updated time range. This new time range indicates the actual period during
/// which AWS WAF selected the requests in the sample.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetSampledRequests service method.</param>
///
/// <returns>The response from the GetSampledRequests service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSampledRequests">REST API Reference for GetSampledRequests Operation</seealso>
public virtual GetSampledRequestsResponse GetSampledRequests(GetSampledRequestsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetSampledRequestsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetSampledRequestsResponseUnmarshaller.Instance;
return Invoke<GetSampledRequestsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetSampledRequests operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetSampledRequests operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSampledRequests">REST API Reference for GetSampledRequests Operation</seealso>
public virtual Task<GetSampledRequestsResponse> GetSampledRequestsAsync(GetSampledRequestsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetSampledRequestsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetSampledRequestsResponseUnmarshaller.Instance;
return InvokeAsync<GetSampledRequestsResponse>(request, options, cancellationToken);
}
#endregion
#region GetSizeConstraintSet
/// <summary>
/// Returns the <a>SizeConstraintSet</a> specified by <code>SizeConstraintSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetSizeConstraintSet service method.</param>
///
/// <returns>The response from the GetSizeConstraintSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSizeConstraintSet">REST API Reference for GetSizeConstraintSet Operation</seealso>
public virtual GetSizeConstraintSetResponse GetSizeConstraintSet(GetSizeConstraintSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetSizeConstraintSetResponseUnmarshaller.Instance;
return Invoke<GetSizeConstraintSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetSizeConstraintSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetSizeConstraintSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSizeConstraintSet">REST API Reference for GetSizeConstraintSet Operation</seealso>
public virtual Task<GetSizeConstraintSetResponse> GetSizeConstraintSetAsync(GetSizeConstraintSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetSizeConstraintSetResponseUnmarshaller.Instance;
return InvokeAsync<GetSizeConstraintSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetSqlInjectionMatchSet
/// <summary>
/// Returns the <a>SqlInjectionMatchSet</a> that is specified by <code>SqlInjectionMatchSetId</code>.
/// </summary>
/// <param name="sqlInjectionMatchSetId">The <code>SqlInjectionMatchSetId</code> of the <a>SqlInjectionMatchSet</a> that you want to get. <code>SqlInjectionMatchSetId</code> is returned by <a>CreateSqlInjectionMatchSet</a> and by <a>ListSqlInjectionMatchSets</a>.</param>
///
/// <returns>The response from the GetSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSqlInjectionMatchSet">REST API Reference for GetSqlInjectionMatchSet Operation</seealso>
public virtual GetSqlInjectionMatchSetResponse GetSqlInjectionMatchSet(string sqlInjectionMatchSetId)
{
var request = new GetSqlInjectionMatchSetRequest();
request.SqlInjectionMatchSetId = sqlInjectionMatchSetId;
return GetSqlInjectionMatchSet(request);
}
/// <summary>
/// Returns the <a>SqlInjectionMatchSet</a> that is specified by <code>SqlInjectionMatchSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetSqlInjectionMatchSet service method.</param>
///
/// <returns>The response from the GetSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSqlInjectionMatchSet">REST API Reference for GetSqlInjectionMatchSet Operation</seealso>
public virtual GetSqlInjectionMatchSetResponse GetSqlInjectionMatchSet(GetSqlInjectionMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetSqlInjectionMatchSetResponseUnmarshaller.Instance;
return Invoke<GetSqlInjectionMatchSetResponse>(request, options);
}
/// <summary>
/// Returns the <a>SqlInjectionMatchSet</a> that is specified by <code>SqlInjectionMatchSetId</code>.
/// </summary>
/// <param name="sqlInjectionMatchSetId">The <code>SqlInjectionMatchSetId</code> of the <a>SqlInjectionMatchSet</a> that you want to get. <code>SqlInjectionMatchSetId</code> is returned by <a>CreateSqlInjectionMatchSet</a> and by <a>ListSqlInjectionMatchSets</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSqlInjectionMatchSet">REST API Reference for GetSqlInjectionMatchSet Operation</seealso>
public virtual Task<GetSqlInjectionMatchSetResponse> GetSqlInjectionMatchSetAsync(string sqlInjectionMatchSetId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new GetSqlInjectionMatchSetRequest();
request.SqlInjectionMatchSetId = sqlInjectionMatchSetId;
return GetSqlInjectionMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the GetSqlInjectionMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetSqlInjectionMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSqlInjectionMatchSet">REST API Reference for GetSqlInjectionMatchSet Operation</seealso>
public virtual Task<GetSqlInjectionMatchSetResponse> GetSqlInjectionMatchSetAsync(GetSqlInjectionMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetSqlInjectionMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<GetSqlInjectionMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region GetWebACL
/// <summary>
/// Returns the <a>WebACL</a> that is specified by <code>WebACLId</code>.
/// </summary>
/// <param name="webACLId">The <code>WebACLId</code> of the <a>WebACL</a> that you want to get. <code>WebACLId</code> is returned by <a>CreateWebACL</a> and by <a>ListWebACLs</a>.</param>
///
/// <returns>The response from the GetWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetWebACL">REST API Reference for GetWebACL Operation</seealso>
public virtual GetWebACLResponse GetWebACL(string webACLId)
{
var request = new GetWebACLRequest();
request.WebACLId = webACLId;
return GetWebACL(request);
}
/// <summary>
/// Returns the <a>WebACL</a> that is specified by <code>WebACLId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetWebACL service method.</param>
///
/// <returns>The response from the GetWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetWebACL">REST API Reference for GetWebACL Operation</seealso>
public virtual GetWebACLResponse GetWebACL(GetWebACLRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetWebACLResponseUnmarshaller.Instance;
return Invoke<GetWebACLResponse>(request, options);
}
/// <summary>
/// Returns the <a>WebACL</a> that is specified by <code>WebACLId</code>.
/// </summary>
/// <param name="webACLId">The <code>WebACLId</code> of the <a>WebACL</a> that you want to get. <code>WebACLId</code> is returned by <a>CreateWebACL</a> and by <a>ListWebACLs</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetWebACL">REST API Reference for GetWebACL Operation</seealso>
public virtual Task<GetWebACLResponse> GetWebACLAsync(string webACLId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new GetWebACLRequest();
request.WebACLId = webACLId;
return GetWebACLAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the GetWebACL operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetWebACL operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetWebACL">REST API Reference for GetWebACL Operation</seealso>
public virtual Task<GetWebACLResponse> GetWebACLAsync(GetWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetWebACLResponseUnmarshaller.Instance;
return InvokeAsync<GetWebACLResponse>(request, options, cancellationToken);
}
#endregion
#region GetXssMatchSet
/// <summary>
/// Returns the <a>XssMatchSet</a> that is specified by <code>XssMatchSetId</code>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetXssMatchSet service method.</param>
///
/// <returns>The response from the GetXssMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetXssMatchSet">REST API Reference for GetXssMatchSet Operation</seealso>
public virtual GetXssMatchSetResponse GetXssMatchSet(GetXssMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetXssMatchSetResponseUnmarshaller.Instance;
return Invoke<GetXssMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetXssMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetXssMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetXssMatchSet">REST API Reference for GetXssMatchSet Operation</seealso>
public virtual Task<GetXssMatchSetResponse> GetXssMatchSetAsync(GetXssMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetXssMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<GetXssMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region ListActivatedRulesInRuleGroup
/// <summary>
/// Returns an array of <a>ActivatedRule</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListActivatedRulesInRuleGroup service method.</param>
///
/// <returns>The response from the ListActivatedRulesInRuleGroup service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListActivatedRulesInRuleGroup">REST API Reference for ListActivatedRulesInRuleGroup Operation</seealso>
public virtual ListActivatedRulesInRuleGroupResponse ListActivatedRulesInRuleGroup(ListActivatedRulesInRuleGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListActivatedRulesInRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListActivatedRulesInRuleGroupResponseUnmarshaller.Instance;
return Invoke<ListActivatedRulesInRuleGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListActivatedRulesInRuleGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListActivatedRulesInRuleGroup operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListActivatedRulesInRuleGroup">REST API Reference for ListActivatedRulesInRuleGroup Operation</seealso>
public virtual Task<ListActivatedRulesInRuleGroupResponse> ListActivatedRulesInRuleGroupAsync(ListActivatedRulesInRuleGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListActivatedRulesInRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListActivatedRulesInRuleGroupResponseUnmarshaller.Instance;
return InvokeAsync<ListActivatedRulesInRuleGroupResponse>(request, options, cancellationToken);
}
#endregion
#region ListByteMatchSets
/// <summary>
/// Returns an array of <a>ByteMatchSetSummary</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListByteMatchSets service method.</param>
///
/// <returns>The response from the ListByteMatchSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListByteMatchSets">REST API Reference for ListByteMatchSets Operation</seealso>
public virtual ListByteMatchSetsResponse ListByteMatchSets(ListByteMatchSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListByteMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListByteMatchSetsResponseUnmarshaller.Instance;
return Invoke<ListByteMatchSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListByteMatchSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListByteMatchSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListByteMatchSets">REST API Reference for ListByteMatchSets Operation</seealso>
public virtual Task<ListByteMatchSetsResponse> ListByteMatchSetsAsync(ListByteMatchSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListByteMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListByteMatchSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListByteMatchSetsResponse>(request, options, cancellationToken);
}
#endregion
#region ListGeoMatchSets
/// <summary>
/// Returns an array of <a>GeoMatchSetSummary</a> objects in the response.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListGeoMatchSets service method.</param>
///
/// <returns>The response from the ListGeoMatchSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListGeoMatchSets">REST API Reference for ListGeoMatchSets Operation</seealso>
public virtual ListGeoMatchSetsResponse ListGeoMatchSets(ListGeoMatchSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListGeoMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListGeoMatchSetsResponseUnmarshaller.Instance;
return Invoke<ListGeoMatchSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListGeoMatchSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListGeoMatchSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListGeoMatchSets">REST API Reference for ListGeoMatchSets Operation</seealso>
public virtual Task<ListGeoMatchSetsResponse> ListGeoMatchSetsAsync(ListGeoMatchSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListGeoMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListGeoMatchSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListGeoMatchSetsResponse>(request, options, cancellationToken);
}
#endregion
#region ListIPSets
/// <summary>
/// Returns an array of <a>IPSetSummary</a> objects in the response.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListIPSets service method.</param>
///
/// <returns>The response from the ListIPSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListIPSets">REST API Reference for ListIPSets Operation</seealso>
public virtual ListIPSetsResponse ListIPSets(ListIPSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListIPSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListIPSetsResponseUnmarshaller.Instance;
return Invoke<ListIPSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListIPSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListIPSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListIPSets">REST API Reference for ListIPSets Operation</seealso>
public virtual Task<ListIPSetsResponse> ListIPSetsAsync(ListIPSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListIPSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListIPSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListIPSetsResponse>(request, options, cancellationToken);
}
#endregion
#region ListLoggingConfigurations
/// <summary>
/// Returns an array of <a>LoggingConfiguration</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListLoggingConfigurations service method.</param>
///
/// <returns>The response from the ListLoggingConfigurations service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListLoggingConfigurations">REST API Reference for ListLoggingConfigurations Operation</seealso>
public virtual ListLoggingConfigurationsResponse ListLoggingConfigurations(ListLoggingConfigurationsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListLoggingConfigurationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListLoggingConfigurationsResponseUnmarshaller.Instance;
return Invoke<ListLoggingConfigurationsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListLoggingConfigurations operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListLoggingConfigurations operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListLoggingConfigurations">REST API Reference for ListLoggingConfigurations Operation</seealso>
public virtual Task<ListLoggingConfigurationsResponse> ListLoggingConfigurationsAsync(ListLoggingConfigurationsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListLoggingConfigurationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListLoggingConfigurationsResponseUnmarshaller.Instance;
return InvokeAsync<ListLoggingConfigurationsResponse>(request, options, cancellationToken);
}
#endregion
#region ListRateBasedRules
/// <summary>
/// Returns an array of <a>RuleSummary</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListRateBasedRules service method.</param>
///
/// <returns>The response from the ListRateBasedRules service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRateBasedRules">REST API Reference for ListRateBasedRules Operation</seealso>
public virtual ListRateBasedRulesResponse ListRateBasedRules(ListRateBasedRulesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRateBasedRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRateBasedRulesResponseUnmarshaller.Instance;
return Invoke<ListRateBasedRulesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListRateBasedRules operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListRateBasedRules operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRateBasedRules">REST API Reference for ListRateBasedRules Operation</seealso>
public virtual Task<ListRateBasedRulesResponse> ListRateBasedRulesAsync(ListRateBasedRulesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRateBasedRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRateBasedRulesResponseUnmarshaller.Instance;
return InvokeAsync<ListRateBasedRulesResponse>(request, options, cancellationToken);
}
#endregion
#region ListRegexMatchSets
/// <summary>
/// Returns an array of <a>RegexMatchSetSummary</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListRegexMatchSets service method.</param>
///
/// <returns>The response from the ListRegexMatchSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRegexMatchSets">REST API Reference for ListRegexMatchSets Operation</seealso>
public virtual ListRegexMatchSetsResponse ListRegexMatchSets(ListRegexMatchSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRegexMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRegexMatchSetsResponseUnmarshaller.Instance;
return Invoke<ListRegexMatchSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListRegexMatchSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListRegexMatchSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRegexMatchSets">REST API Reference for ListRegexMatchSets Operation</seealso>
public virtual Task<ListRegexMatchSetsResponse> ListRegexMatchSetsAsync(ListRegexMatchSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRegexMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRegexMatchSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListRegexMatchSetsResponse>(request, options, cancellationToken);
}
#endregion
#region ListRegexPatternSets
/// <summary>
/// Returns an array of <a>RegexPatternSetSummary</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListRegexPatternSets service method.</param>
///
/// <returns>The response from the ListRegexPatternSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRegexPatternSets">REST API Reference for ListRegexPatternSets Operation</seealso>
public virtual ListRegexPatternSetsResponse ListRegexPatternSets(ListRegexPatternSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRegexPatternSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRegexPatternSetsResponseUnmarshaller.Instance;
return Invoke<ListRegexPatternSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListRegexPatternSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListRegexPatternSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRegexPatternSets">REST API Reference for ListRegexPatternSets Operation</seealso>
public virtual Task<ListRegexPatternSetsResponse> ListRegexPatternSetsAsync(ListRegexPatternSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRegexPatternSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRegexPatternSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListRegexPatternSetsResponse>(request, options, cancellationToken);
}
#endregion
#region ListRuleGroups
/// <summary>
/// Returns an array of <a>RuleGroup</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListRuleGroups service method.</param>
///
/// <returns>The response from the ListRuleGroups service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRuleGroups">REST API Reference for ListRuleGroups Operation</seealso>
public virtual ListRuleGroupsResponse ListRuleGroups(ListRuleGroupsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRuleGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRuleGroupsResponseUnmarshaller.Instance;
return Invoke<ListRuleGroupsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListRuleGroups operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListRuleGroups operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRuleGroups">REST API Reference for ListRuleGroups Operation</seealso>
public virtual Task<ListRuleGroupsResponse> ListRuleGroupsAsync(ListRuleGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRuleGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRuleGroupsResponseUnmarshaller.Instance;
return InvokeAsync<ListRuleGroupsResponse>(request, options, cancellationToken);
}
#endregion
#region ListRules
/// <summary>
/// Returns an array of <a>RuleSummary</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListRules service method.</param>
///
/// <returns>The response from the ListRules service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRules">REST API Reference for ListRules Operation</seealso>
public virtual ListRulesResponse ListRules(ListRulesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;
return Invoke<ListRulesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListRules operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListRules operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRules">REST API Reference for ListRules Operation</seealso>
public virtual Task<ListRulesResponse> ListRulesAsync(ListRulesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;
return InvokeAsync<ListRulesResponse>(request, options, cancellationToken);
}
#endregion
#region ListSizeConstraintSets
/// <summary>
/// Returns an array of <a>SizeConstraintSetSummary</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListSizeConstraintSets service method.</param>
///
/// <returns>The response from the ListSizeConstraintSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSizeConstraintSets">REST API Reference for ListSizeConstraintSets Operation</seealso>
public virtual ListSizeConstraintSetsResponse ListSizeConstraintSets(ListSizeConstraintSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListSizeConstraintSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListSizeConstraintSetsResponseUnmarshaller.Instance;
return Invoke<ListSizeConstraintSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListSizeConstraintSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListSizeConstraintSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSizeConstraintSets">REST API Reference for ListSizeConstraintSets Operation</seealso>
public virtual Task<ListSizeConstraintSetsResponse> ListSizeConstraintSetsAsync(ListSizeConstraintSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListSizeConstraintSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListSizeConstraintSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListSizeConstraintSetsResponse>(request, options, cancellationToken);
}
#endregion
#region ListSqlInjectionMatchSets
/// <summary>
/// Returns an array of <a>SqlInjectionMatchSet</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListSqlInjectionMatchSets service method.</param>
///
/// <returns>The response from the ListSqlInjectionMatchSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSqlInjectionMatchSets">REST API Reference for ListSqlInjectionMatchSets Operation</seealso>
public virtual ListSqlInjectionMatchSetsResponse ListSqlInjectionMatchSets(ListSqlInjectionMatchSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListSqlInjectionMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListSqlInjectionMatchSetsResponseUnmarshaller.Instance;
return Invoke<ListSqlInjectionMatchSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListSqlInjectionMatchSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListSqlInjectionMatchSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSqlInjectionMatchSets">REST API Reference for ListSqlInjectionMatchSets Operation</seealso>
public virtual Task<ListSqlInjectionMatchSetsResponse> ListSqlInjectionMatchSetsAsync(ListSqlInjectionMatchSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListSqlInjectionMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListSqlInjectionMatchSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListSqlInjectionMatchSetsResponse>(request, options, cancellationToken);
}
#endregion
#region ListSubscribedRuleGroups
/// <summary>
/// Returns an array of <a>RuleGroup</a> objects that you are subscribed to.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListSubscribedRuleGroups service method.</param>
///
/// <returns>The response from the ListSubscribedRuleGroups service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSubscribedRuleGroups">REST API Reference for ListSubscribedRuleGroups Operation</seealso>
public virtual ListSubscribedRuleGroupsResponse ListSubscribedRuleGroups(ListSubscribedRuleGroupsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListSubscribedRuleGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListSubscribedRuleGroupsResponseUnmarshaller.Instance;
return Invoke<ListSubscribedRuleGroupsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListSubscribedRuleGroups operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListSubscribedRuleGroups operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSubscribedRuleGroups">REST API Reference for ListSubscribedRuleGroups Operation</seealso>
public virtual Task<ListSubscribedRuleGroupsResponse> ListSubscribedRuleGroupsAsync(ListSubscribedRuleGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListSubscribedRuleGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListSubscribedRuleGroupsResponseUnmarshaller.Instance;
return InvokeAsync<ListSubscribedRuleGroupsResponse>(request, options, cancellationToken);
}
#endregion
#region ListWebACLs
/// <summary>
/// Returns an array of <a>WebACLSummary</a> objects in the response.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListWebACLs service method.</param>
///
/// <returns>The response from the ListWebACLs service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListWebACLs">REST API Reference for ListWebACLs Operation</seealso>
public virtual ListWebACLsResponse ListWebACLs(ListWebACLsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListWebACLsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListWebACLsResponseUnmarshaller.Instance;
return Invoke<ListWebACLsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListWebACLs operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListWebACLs operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListWebACLs">REST API Reference for ListWebACLs Operation</seealso>
public virtual Task<ListWebACLsResponse> ListWebACLsAsync(ListWebACLsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListWebACLsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListWebACLsResponseUnmarshaller.Instance;
return InvokeAsync<ListWebACLsResponse>(request, options, cancellationToken);
}
#endregion
#region ListXssMatchSets
/// <summary>
/// Returns an array of <a>XssMatchSet</a> objects.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListXssMatchSets service method.</param>
///
/// <returns>The response from the ListXssMatchSets service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListXssMatchSets">REST API Reference for ListXssMatchSets Operation</seealso>
public virtual ListXssMatchSetsResponse ListXssMatchSets(ListXssMatchSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListXssMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListXssMatchSetsResponseUnmarshaller.Instance;
return Invoke<ListXssMatchSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListXssMatchSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListXssMatchSets operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListXssMatchSets">REST API Reference for ListXssMatchSets Operation</seealso>
public virtual Task<ListXssMatchSetsResponse> ListXssMatchSetsAsync(ListXssMatchSetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListXssMatchSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListXssMatchSetsResponseUnmarshaller.Instance;
return InvokeAsync<ListXssMatchSetsResponse>(request, options, cancellationToken);
}
#endregion
#region PutLoggingConfiguration
/// <summary>
/// Associates a <a>LoggingConfiguration</a> with a specified web ACL.
///
///
/// <para>
/// You can access information about all traffic that AWS WAF inspects using the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create an Amazon Kinesis Data Firehose .
/// </para>
///
/// <para>
/// Create the data firehose with a PUT source and in the region that you are operating.
/// However, if you are capturing logs for Amazon CloudFront, always create the firehose
/// in US East (N. Virginia).
/// </para>
/// </li> <li>
/// <para>
/// Associate that firehose to your web ACL using a <code>PutLoggingConfiguration</code>
/// request.
/// </para>
/// </li> </ol>
/// <para>
/// When you successfully enable logging using a <code>PutLoggingConfiguration</code>
/// request, AWS WAF will create a service linked role with the necessary permissions
/// to write logs to the Amazon Kinesis Data Firehose. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/logging.html">Logging
/// Web ACL Traffic Information</a> in the <i>AWS WAF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutLoggingConfiguration service method.</param>
///
/// <returns>The response from the PutLoggingConfiguration service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFServiceLinkedRoleErrorException">
/// AWS WAF is not able to access the service linked role. This can be caused by a previous
/// <code>PutLoggingConfiguration</code> request, which can lock the service linked role
/// for about 20 seconds. Please try your request again. The service linked role can also
/// be locked by a previous <code>DeleteServiceLinkedRole</code> request, which can lock
/// the role for 15 minutes or more. If you recently made a <code>DeleteServiceLinkedRole</code>,
/// wait at least 15 minutes and try the request again. If you receive this same exception
/// again, you will have to wait additional time until the role is unlocked.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/PutLoggingConfiguration">REST API Reference for PutLoggingConfiguration Operation</seealso>
public virtual PutLoggingConfigurationResponse PutLoggingConfiguration(PutLoggingConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutLoggingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutLoggingConfigurationResponseUnmarshaller.Instance;
return Invoke<PutLoggingConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutLoggingConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutLoggingConfiguration operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/PutLoggingConfiguration">REST API Reference for PutLoggingConfiguration Operation</seealso>
public virtual Task<PutLoggingConfigurationResponse> PutLoggingConfigurationAsync(PutLoggingConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = PutLoggingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutLoggingConfigurationResponseUnmarshaller.Instance;
return InvokeAsync<PutLoggingConfigurationResponse>(request, options, cancellationToken);
}
#endregion
#region PutPermissionPolicy
/// <summary>
/// Attaches a IAM policy to the specified resource. The only supported use for this action
/// is to share a RuleGroup across accounts.
///
///
/// <para>
/// The <code>PutPermissionPolicy</code> is subject to the following restrictions:
/// </para>
/// <ul> <li>
/// <para>
/// You can attach only one policy with each <code>PutPermissionPolicy</code> request.
/// </para>
/// </li> <li>
/// <para>
/// The policy must include an <code>Effect</code>, <code>Action</code> and <code>Principal</code>.
///
/// </para>
/// </li> <li>
/// <para>
/// <code>Effect</code> must specify <code>Allow</code>.
/// </para>
/// </li> <li>
/// <para>
/// The <code>Action</code> in the policy must be <code>waf:UpdateWebACL</code>, <code>waf-regional:UpdateWebACL</code>,
/// <code>waf:GetRuleGroup</code> and <code>waf-regional:GetRuleGroup</code> . Any extra
/// or wildcard actions in the policy will be rejected.
/// </para>
/// </li> <li>
/// <para>
/// The policy cannot include a <code>Resource</code> parameter.
/// </para>
/// </li> <li>
/// <para>
/// The ARN in the request must be a valid WAF RuleGroup ARN and the RuleGroup must exist
/// in the same region.
/// </para>
/// </li> <li>
/// <para>
/// The user making the request must be the owner of the RuleGroup.
/// </para>
/// </li> <li>
/// <para>
/// Your policy must be composed using IAM Policy version 2012-10-17.
/// </para>
/// </li> </ul>
/// <para>
/// For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html">IAM
/// Policies</a>.
/// </para>
///
/// <para>
/// An example of a valid policy parameter is shown in the Examples section below.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutPermissionPolicy service method.</param>
///
/// <returns>The response from the PutPermissionPolicy service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidPermissionPolicyException">
/// The operation failed because the specified policy is not in the proper format.
///
///
/// <para>
/// The policy is subject to the following restrictions:
/// </para>
/// <ul> <li>
/// <para>
/// You can attach only one policy with each <code>PutPermissionPolicy</code> request.
/// </para>
/// </li> <li>
/// <para>
/// The policy must include an <code>Effect</code>, <code>Action</code> and <code>Principal</code>.
///
/// </para>
/// </li> <li>
/// <para>
/// <code>Effect</code> must specify <code>Allow</code>.
/// </para>
/// </li> <li>
/// <para>
/// The <code>Action</code> in the policy must be <code>waf:UpdateWebACL</code>, <code>waf-regional:UpdateWebACL</code>,
/// <code>waf:GetRuleGroup</code> and <code>waf-regional:GetRuleGroup</code> . Any extra
/// or wildcard actions in the policy will be rejected.
/// </para>
/// </li> <li>
/// <para>
/// The policy cannot include a <code>Resource</code> parameter.
/// </para>
/// </li> <li>
/// <para>
/// The ARN in the request must be a valid WAF RuleGroup ARN and the RuleGroup must exist
/// in the same region.
/// </para>
/// </li> <li>
/// <para>
/// The user making the request must be the owner of the RuleGroup.
/// </para>
/// </li> <li>
/// <para>
/// Your policy must be composed using IAM Policy version 2012-10-17.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/PutPermissionPolicy">REST API Reference for PutPermissionPolicy Operation</seealso>
public virtual PutPermissionPolicyResponse PutPermissionPolicy(PutPermissionPolicyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutPermissionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutPermissionPolicyResponseUnmarshaller.Instance;
return Invoke<PutPermissionPolicyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutPermissionPolicy operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutPermissionPolicy operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/PutPermissionPolicy">REST API Reference for PutPermissionPolicy Operation</seealso>
public virtual Task<PutPermissionPolicyResponse> PutPermissionPolicyAsync(PutPermissionPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = PutPermissionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutPermissionPolicyResponseUnmarshaller.Instance;
return InvokeAsync<PutPermissionPolicyResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateByteMatchSet
/// <summary>
/// Inserts or deletes <a>ByteMatchTuple</a> objects (filters) in a <a>ByteMatchSet</a>.
/// For each <code>ByteMatchTuple</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change a <code>ByteMatchSetUpdate</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The part of a web request that you want AWS WAF to inspect, such as a query string
/// or the value of the <code>User-Agent</code> header.
/// </para>
/// </li> <li>
/// <para>
/// The bytes (typically a string that corresponds with ASCII characters) that you want
/// AWS WAF to look for. For more information, including how you specify the values for
/// the AWS WAF API and the AWS CLI or SDKs, see <code>TargetString</code> in the <a>ByteMatchTuple</a>
/// data type.
/// </para>
/// </li> <li>
/// <para>
/// Where to look, such as at the beginning or the end of a query string.
/// </para>
/// </li> <li>
/// <para>
/// Whether to perform any conversions on the request, such as converting it to lowercase,
/// before inspecting it for the specified string.
/// </para>
/// </li> </ul>
/// <para>
/// For example, you can add a <code>ByteMatchSetUpdate</code> object that matches web
/// requests in which <code>User-Agent</code> headers contain the string <code>BadBot</code>.
/// You can then configure AWS WAF to block those requests.
/// </para>
///
/// <para>
/// To create and configure a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create a <code>ByteMatchSet.</code> For more information, see <a>CreateByteMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateByteMatchSet</code> request to specify the part of the request
/// that you want AWS WAF to inspect (for example, the header or the URI) and the value
/// that you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="byteMatchSetId">The <code>ByteMatchSetId</code> of the <a>ByteMatchSet</a> that you want to update. <code>ByteMatchSetId</code> is returned by <a>CreateByteMatchSet</a> and by <a>ListByteMatchSets</a>.</param>
/// <param name="updates">An array of <code>ByteMatchSetUpdate</code> objects that you want to insert into or delete from a <a>ByteMatchSet</a>. For more information, see the applicable data types: <ul> <li> <a>ByteMatchSetUpdate</a>: Contains <code>Action</code> and <code>ByteMatchTuple</code> </li> <li> <a>ByteMatchTuple</a>: Contains <code>FieldToMatch</code>, <code>PositionalConstraint</code>, <code>TargetString</code>, and <code>TextTransformation</code> </li> <li> <a>FieldToMatch</a>: Contains <code>Data</code> and <code>Type</code> </li> </ul></param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the UpdateByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateByteMatchSet">REST API Reference for UpdateByteMatchSet Operation</seealso>
public virtual UpdateByteMatchSetResponse UpdateByteMatchSet(string byteMatchSetId, List<ByteMatchSetUpdate> updates, string changeToken)
{
var request = new UpdateByteMatchSetRequest();
request.ByteMatchSetId = byteMatchSetId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateByteMatchSet(request);
}
/// <summary>
/// Inserts or deletes <a>ByteMatchTuple</a> objects (filters) in a <a>ByteMatchSet</a>.
/// For each <code>ByteMatchTuple</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change a <code>ByteMatchSetUpdate</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The part of a web request that you want AWS WAF to inspect, such as a query string
/// or the value of the <code>User-Agent</code> header.
/// </para>
/// </li> <li>
/// <para>
/// The bytes (typically a string that corresponds with ASCII characters) that you want
/// AWS WAF to look for. For more information, including how you specify the values for
/// the AWS WAF API and the AWS CLI or SDKs, see <code>TargetString</code> in the <a>ByteMatchTuple</a>
/// data type.
/// </para>
/// </li> <li>
/// <para>
/// Where to look, such as at the beginning or the end of a query string.
/// </para>
/// </li> <li>
/// <para>
/// Whether to perform any conversions on the request, such as converting it to lowercase,
/// before inspecting it for the specified string.
/// </para>
/// </li> </ul>
/// <para>
/// For example, you can add a <code>ByteMatchSetUpdate</code> object that matches web
/// requests in which <code>User-Agent</code> headers contain the string <code>BadBot</code>.
/// You can then configure AWS WAF to block those requests.
/// </para>
///
/// <para>
/// To create and configure a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create a <code>ByteMatchSet.</code> For more information, see <a>CreateByteMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateByteMatchSet</code> request to specify the part of the request
/// that you want AWS WAF to inspect (for example, the header or the URI) and the value
/// that you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateByteMatchSet service method.</param>
///
/// <returns>The response from the UpdateByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateByteMatchSet">REST API Reference for UpdateByteMatchSet Operation</seealso>
public virtual UpdateByteMatchSetResponse UpdateByteMatchSet(UpdateByteMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateByteMatchSetResponseUnmarshaller.Instance;
return Invoke<UpdateByteMatchSetResponse>(request, options);
}
/// <summary>
/// Inserts or deletes <a>ByteMatchTuple</a> objects (filters) in a <a>ByteMatchSet</a>.
/// For each <code>ByteMatchTuple</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change a <code>ByteMatchSetUpdate</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The part of a web request that you want AWS WAF to inspect, such as a query string
/// or the value of the <code>User-Agent</code> header.
/// </para>
/// </li> <li>
/// <para>
/// The bytes (typically a string that corresponds with ASCII characters) that you want
/// AWS WAF to look for. For more information, including how you specify the values for
/// the AWS WAF API and the AWS CLI or SDKs, see <code>TargetString</code> in the <a>ByteMatchTuple</a>
/// data type.
/// </para>
/// </li> <li>
/// <para>
/// Where to look, such as at the beginning or the end of a query string.
/// </para>
/// </li> <li>
/// <para>
/// Whether to perform any conversions on the request, such as converting it to lowercase,
/// before inspecting it for the specified string.
/// </para>
/// </li> </ul>
/// <para>
/// For example, you can add a <code>ByteMatchSetUpdate</code> object that matches web
/// requests in which <code>User-Agent</code> headers contain the string <code>BadBot</code>.
/// You can then configure AWS WAF to block those requests.
/// </para>
///
/// <para>
/// To create and configure a <code>ByteMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create a <code>ByteMatchSet.</code> For more information, see <a>CreateByteMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateByteMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateByteMatchSet</code> request to specify the part of the request
/// that you want AWS WAF to inspect (for example, the header or the URI) and the value
/// that you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="byteMatchSetId">The <code>ByteMatchSetId</code> of the <a>ByteMatchSet</a> that you want to update. <code>ByteMatchSetId</code> is returned by <a>CreateByteMatchSet</a> and by <a>ListByteMatchSets</a>.</param>
/// <param name="updates">An array of <code>ByteMatchSetUpdate</code> objects that you want to insert into or delete from a <a>ByteMatchSet</a>. For more information, see the applicable data types: <ul> <li> <a>ByteMatchSetUpdate</a>: Contains <code>Action</code> and <code>ByteMatchTuple</code> </li> <li> <a>ByteMatchTuple</a>: Contains <code>FieldToMatch</code>, <code>PositionalConstraint</code>, <code>TargetString</code>, and <code>TextTransformation</code> </li> <li> <a>FieldToMatch</a>: Contains <code>Data</code> and <code>Type</code> </li> </ul></param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateByteMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateByteMatchSet">REST API Reference for UpdateByteMatchSet Operation</seealso>
public virtual Task<UpdateByteMatchSetResponse> UpdateByteMatchSetAsync(string byteMatchSetId, List<ByteMatchSetUpdate> updates, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new UpdateByteMatchSetRequest();
request.ByteMatchSetId = byteMatchSetId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateByteMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateByteMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateByteMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateByteMatchSet">REST API Reference for UpdateByteMatchSet Operation</seealso>
public virtual Task<UpdateByteMatchSetResponse> UpdateByteMatchSetAsync(UpdateByteMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateByteMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateByteMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateByteMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateGeoMatchSet
/// <summary>
/// Inserts or deletes <a>GeoMatchConstraint</a> objects in an <code>GeoMatchSet</code>.
/// For each <code>GeoMatchConstraint</code> object, you specify the following values:
///
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change an <code>GeoMatchConstraint</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The <code>Type</code>. The only valid value for <code>Type</code> is <code>Country</code>.
/// </para>
/// </li> <li>
/// <para>
/// The <code>Value</code>, which is a two character code for the country to add to the
/// <code>GeoMatchConstraint</code> object. Valid codes are listed in <a>GeoMatchConstraint$Value</a>.
/// </para>
/// </li> </ul>
/// <para>
/// To create and configure an <code>GeoMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateGeoMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateGeoMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateGeoMatchSet</code> request to specify the country that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// When you update an <code>GeoMatchSet</code>, you specify the country that you want
/// to add and/or the country that you want to delete. If you want to change a country,
/// you delete the existing country and add the new one.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateGeoMatchSet service method.</param>
///
/// <returns>The response from the UpdateGeoMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateGeoMatchSet">REST API Reference for UpdateGeoMatchSet Operation</seealso>
public virtual UpdateGeoMatchSetResponse UpdateGeoMatchSet(UpdateGeoMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateGeoMatchSetResponseUnmarshaller.Instance;
return Invoke<UpdateGeoMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateGeoMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateGeoMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateGeoMatchSet">REST API Reference for UpdateGeoMatchSet Operation</seealso>
public virtual Task<UpdateGeoMatchSetResponse> UpdateGeoMatchSetAsync(UpdateGeoMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateGeoMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateGeoMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateGeoMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateIPSet
/// <summary>
/// Inserts or deletes <a>IPSetDescriptor</a> objects in an <code>IPSet</code>. For each
/// <code>IPSetDescriptor</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change an <code>IPSetDescriptor</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The IP address version, <code>IPv4</code> or <code>IPv6</code>.
/// </para>
/// </li> <li>
/// <para>
/// The IP address in CIDR notation, for example, <code>192.0.2.0/24</code> (for the range
/// of IP addresses from <code>192.0.2.0</code> to <code>192.0.2.255</code>) or <code>192.0.2.44/32</code>
/// (for the individual IP address <code>192.0.2.44</code>).
/// </para>
/// </li> </ul>
/// <para>
/// AWS WAF supports IPv4 address ranges: /8 and any range between /16 through /32. AWS
/// WAF supports IPv6 address ranges: /24, /32, /48, /56, /64, and /128. For more information
/// about CIDR notation, see the Wikipedia entry <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless
/// Inter-Domain Routing</a>.
/// </para>
///
/// <para>
/// IPv6 addresses can be represented using any of the following formats:
/// </para>
/// <ul> <li>
/// <para>
/// 1111:0000:0000:0000:0000:0000:0000:0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111:0:0:0:0:0:0:0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111::0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111::111/128
/// </para>
/// </li> </ul>
/// <para>
/// You use an <code>IPSet</code> to specify which web requests you want to allow or block
/// based on the IP addresses that the requests originated from. For example, if you're
/// receiving a lot of requests from one or a small number of IP addresses and you want
/// to block the requests, you can create an <code>IPSet</code> that specifies those IP
/// addresses, and then configure AWS WAF to block the requests.
/// </para>
///
/// <para>
/// To create and configure an <code>IPSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateIPSet</code> request to specify the IP addresses that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// When you update an <code>IPSet</code>, you specify the IP addresses that you want
/// to add and/or the IP addresses that you want to delete. If you want to change an IP
/// address, you delete the existing IP address and add the new one.
/// </para>
///
/// <para>
/// You can insert a maximum of 1000 addresses in a single request.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="ipSetId">The <code>IPSetId</code> of the <a>IPSet</a> that you want to update. <code>IPSetId</code> is returned by <a>CreateIPSet</a> and by <a>ListIPSets</a>.</param>
/// <param name="updates">An array of <code>IPSetUpdate</code> objects that you want to insert into or delete from an <a>IPSet</a>. For more information, see the applicable data types: <ul> <li> <a>IPSetUpdate</a>: Contains <code>Action</code> and <code>IPSetDescriptor</code> </li> <li> <a>IPSetDescriptor</a>: Contains <code>Type</code> and <code>Value</code> </li> </ul> You can insert a maximum of 1000 addresses in a single request.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the UpdateIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateIPSet">REST API Reference for UpdateIPSet Operation</seealso>
public virtual UpdateIPSetResponse UpdateIPSet(string ipSetId, List<IPSetUpdate> updates, string changeToken)
{
var request = new UpdateIPSetRequest();
request.IPSetId = ipSetId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateIPSet(request);
}
/// <summary>
/// Inserts or deletes <a>IPSetDescriptor</a> objects in an <code>IPSet</code>. For each
/// <code>IPSetDescriptor</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change an <code>IPSetDescriptor</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The IP address version, <code>IPv4</code> or <code>IPv6</code>.
/// </para>
/// </li> <li>
/// <para>
/// The IP address in CIDR notation, for example, <code>192.0.2.0/24</code> (for the range
/// of IP addresses from <code>192.0.2.0</code> to <code>192.0.2.255</code>) or <code>192.0.2.44/32</code>
/// (for the individual IP address <code>192.0.2.44</code>).
/// </para>
/// </li> </ul>
/// <para>
/// AWS WAF supports IPv4 address ranges: /8 and any range between /16 through /32. AWS
/// WAF supports IPv6 address ranges: /24, /32, /48, /56, /64, and /128. For more information
/// about CIDR notation, see the Wikipedia entry <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless
/// Inter-Domain Routing</a>.
/// </para>
///
/// <para>
/// IPv6 addresses can be represented using any of the following formats:
/// </para>
/// <ul> <li>
/// <para>
/// 1111:0000:0000:0000:0000:0000:0000:0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111:0:0:0:0:0:0:0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111::0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111::111/128
/// </para>
/// </li> </ul>
/// <para>
/// You use an <code>IPSet</code> to specify which web requests you want to allow or block
/// based on the IP addresses that the requests originated from. For example, if you're
/// receiving a lot of requests from one or a small number of IP addresses and you want
/// to block the requests, you can create an <code>IPSet</code> that specifies those IP
/// addresses, and then configure AWS WAF to block the requests.
/// </para>
///
/// <para>
/// To create and configure an <code>IPSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateIPSet</code> request to specify the IP addresses that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// When you update an <code>IPSet</code>, you specify the IP addresses that you want
/// to add and/or the IP addresses that you want to delete. If you want to change an IP
/// address, you delete the existing IP address and add the new one.
/// </para>
///
/// <para>
/// You can insert a maximum of 1000 addresses in a single request.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateIPSet service method.</param>
///
/// <returns>The response from the UpdateIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateIPSet">REST API Reference for UpdateIPSet Operation</seealso>
public virtual UpdateIPSetResponse UpdateIPSet(UpdateIPSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateIPSetResponseUnmarshaller.Instance;
return Invoke<UpdateIPSetResponse>(request, options);
}
/// <summary>
/// Inserts or deletes <a>IPSetDescriptor</a> objects in an <code>IPSet</code>. For each
/// <code>IPSetDescriptor</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change an <code>IPSetDescriptor</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The IP address version, <code>IPv4</code> or <code>IPv6</code>.
/// </para>
/// </li> <li>
/// <para>
/// The IP address in CIDR notation, for example, <code>192.0.2.0/24</code> (for the range
/// of IP addresses from <code>192.0.2.0</code> to <code>192.0.2.255</code>) or <code>192.0.2.44/32</code>
/// (for the individual IP address <code>192.0.2.44</code>).
/// </para>
/// </li> </ul>
/// <para>
/// AWS WAF supports IPv4 address ranges: /8 and any range between /16 through /32. AWS
/// WAF supports IPv6 address ranges: /24, /32, /48, /56, /64, and /128. For more information
/// about CIDR notation, see the Wikipedia entry <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless
/// Inter-Domain Routing</a>.
/// </para>
///
/// <para>
/// IPv6 addresses can be represented using any of the following formats:
/// </para>
/// <ul> <li>
/// <para>
/// 1111:0000:0000:0000:0000:0000:0000:0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111:0:0:0:0:0:0:0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111::0111/128
/// </para>
/// </li> <li>
/// <para>
/// 1111::111/128
/// </para>
/// </li> </ul>
/// <para>
/// You use an <code>IPSet</code> to specify which web requests you want to allow or block
/// based on the IP addresses that the requests originated from. For example, if you're
/// receiving a lot of requests from one or a small number of IP addresses and you want
/// to block the requests, you can create an <code>IPSet</code> that specifies those IP
/// addresses, and then configure AWS WAF to block the requests.
/// </para>
///
/// <para>
/// To create and configure an <code>IPSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateIPSet</code> request to specify the IP addresses that you want
/// AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// When you update an <code>IPSet</code>, you specify the IP addresses that you want
/// to add and/or the IP addresses that you want to delete. If you want to change an IP
/// address, you delete the existing IP address and add the new one.
/// </para>
///
/// <para>
/// You can insert a maximum of 1000 addresses in a single request.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="ipSetId">The <code>IPSetId</code> of the <a>IPSet</a> that you want to update. <code>IPSetId</code> is returned by <a>CreateIPSet</a> and by <a>ListIPSets</a>.</param>
/// <param name="updates">An array of <code>IPSetUpdate</code> objects that you want to insert into or delete from an <a>IPSet</a>. For more information, see the applicable data types: <ul> <li> <a>IPSetUpdate</a>: Contains <code>Action</code> and <code>IPSetDescriptor</code> </li> <li> <a>IPSetDescriptor</a>: Contains <code>Type</code> and <code>Value</code> </li> </ul> You can insert a maximum of 1000 addresses in a single request.</param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateIPSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateIPSet">REST API Reference for UpdateIPSet Operation</seealso>
public virtual Task<UpdateIPSetResponse> UpdateIPSetAsync(string ipSetId, List<IPSetUpdate> updates, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new UpdateIPSetRequest();
request.IPSetId = ipSetId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateIPSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateIPSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateIPSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateIPSet">REST API Reference for UpdateIPSet Operation</seealso>
public virtual Task<UpdateIPSetResponse> UpdateIPSetAsync(UpdateIPSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateIPSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateIPSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateIPSetResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateRateBasedRule
/// <summary>
/// Inserts or deletes <a>Predicate</a> objects in a rule and updates the <code>RateLimit</code>
/// in the rule.
///
///
/// <para>
/// Each <code>Predicate</code> object identifies a predicate, such as a <a>ByteMatchSet</a>
/// or an <a>IPSet</a>, that specifies the web requests that you want to block or count.
/// The <code>RateLimit</code> specifies the number of requests every five minutes that
/// triggers the rule.
/// </para>
///
/// <para>
/// If you add more than one predicate to a <code>RateBasedRule</code>, a request must
/// match all the predicates and exceed the <code>RateLimit</code> to be counted or blocked.
/// For example, suppose you add the following to a <code>RateBasedRule</code>:
/// </para>
/// <ul> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44/32</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> </ul>
/// <para>
/// Further, you specify a <code>RateLimit</code> of 15,000.
/// </para>
///
/// <para>
/// You then add the <code>RateBasedRule</code> to a <code>WebACL</code> and specify that
/// you want to block requests that satisfy the rule. For a request to be blocked, it
/// must come from the IP address 192.0.2.44 <i>and</i> the <code>User-Agent</code> header
/// in the request must contain the value <code>BadBot</code>. Further, requests that
/// match these two conditions much be received at a rate of more than 15,000 every five
/// minutes. If the rate drops below this limit, AWS WAF no longer blocks the requests.
/// </para>
///
/// <para>
/// As a second example, suppose you want to limit requests to a particular page on your
/// site. To do this, you could add the following to a <code>RateBasedRule</code>:
/// </para>
/// <ul> <li>
/// <para>
/// A <code>ByteMatchSet</code> with <code>FieldToMatch</code> of <code>URI</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>PositionalConstraint</code> of <code>STARTS_WITH</code>
/// </para>
/// </li> <li>
/// <para>
/// A <code>TargetString</code> of <code>login</code>
/// </para>
/// </li> </ul>
/// <para>
/// Further, you specify a <code>RateLimit</code> of 15,000.
/// </para>
///
/// <para>
/// By adding this <code>RateBasedRule</code> to a <code>WebACL</code>, you could limit
/// requests to your login page without affecting the rest of your site.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateRateBasedRule service method.</param>
///
/// <returns>The response from the UpdateRateBasedRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRateBasedRule">REST API Reference for UpdateRateBasedRule Operation</seealso>
public virtual UpdateRateBasedRuleResponse UpdateRateBasedRule(UpdateRateBasedRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRateBasedRuleResponseUnmarshaller.Instance;
return Invoke<UpdateRateBasedRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateRateBasedRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateRateBasedRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRateBasedRule">REST API Reference for UpdateRateBasedRule Operation</seealso>
public virtual Task<UpdateRateBasedRuleResponse> UpdateRateBasedRuleAsync(UpdateRateBasedRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRateBasedRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRateBasedRuleResponseUnmarshaller.Instance;
return InvokeAsync<UpdateRateBasedRuleResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateRegexMatchSet
/// <summary>
/// Inserts or deletes <a>RegexMatchTuple</a> objects (filters) in a <a>RegexMatchSet</a>.
/// For each <code>RegexMatchSetUpdate</code> object, you specify the following values:
///
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change a <code>RegexMatchSetUpdate</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The part of a web request that you want AWS WAF to inspectupdate, such as a query
/// string or the value of the <code>User-Agent</code> header.
/// </para>
/// </li> <li>
/// <para>
/// The identifier of the pattern (a regular expression) that you want AWS WAF to look
/// for. For more information, see <a>RegexPatternSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Whether to perform any conversions on the request, such as converting it to lowercase,
/// before inspecting it for the specified string.
/// </para>
/// </li> </ul>
/// <para>
/// For example, you can create a <code>RegexPatternSet</code> that matches any requests
/// with <code>User-Agent</code> headers that contain the string <code>B[a@]dB[o0]t</code>.
/// You can then configure AWS WAF to reject those requests.
/// </para>
///
/// <para>
/// To create and configure a <code>RegexMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create a <code>RegexMatchSet.</code> For more information, see <a>CreateRegexMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateRegexMatchSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRegexMatchSet</code> request to specify the part of the request
/// that you want AWS WAF to inspect (for example, the header or the URI) and the identifier
/// of the <code>RegexPatternSet</code> that contain the regular expression patters you
/// want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateRegexMatchSet service method.</param>
///
/// <returns>The response from the UpdateRegexMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFDisallowedNameException">
/// The name specified is invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRegexMatchSet">REST API Reference for UpdateRegexMatchSet Operation</seealso>
public virtual UpdateRegexMatchSetResponse UpdateRegexMatchSet(UpdateRegexMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRegexMatchSetResponseUnmarshaller.Instance;
return Invoke<UpdateRegexMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateRegexMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateRegexMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRegexMatchSet">REST API Reference for UpdateRegexMatchSet Operation</seealso>
public virtual Task<UpdateRegexMatchSetResponse> UpdateRegexMatchSetAsync(UpdateRegexMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRegexMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRegexMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateRegexMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateRegexPatternSet
/// <summary>
/// Inserts or deletes <code>RegexPatternString</code> objects in a <a>RegexPatternSet</a>.
/// For each <code>RegexPatternString</code> object, you specify the following values:
///
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the <code>RegexPatternString</code>.
/// </para>
/// </li> <li>
/// <para>
/// The regular expression pattern that you want to insert or delete. For more information,
/// see <a>RegexPatternSet</a>.
/// </para>
/// </li> </ul>
/// <para>
/// For example, you can create a <code>RegexPatternString</code> such as <code>B[a@]dB[o0]t</code>.
/// AWS WAF will match this <code>RegexPatternString</code> to:
/// </para>
/// <ul> <li>
/// <para>
/// BadBot
/// </para>
/// </li> <li>
/// <para>
/// BadB0t
/// </para>
/// </li> <li>
/// <para>
/// B@dBot
/// </para>
/// </li> <li>
/// <para>
/// B@dB0t
/// </para>
/// </li> </ul>
/// <para>
/// To create and configure a <code>RegexPatternSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create a <code>RegexPatternSet.</code> For more information, see <a>CreateRegexPatternSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateRegexPatternSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRegexPatternSet</code> request to specify the regular expression
/// pattern that you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateRegexPatternSet service method.</param>
///
/// <returns>The response from the UpdateRegexPatternSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidRegexPatternException">
/// The regular expression (regex) you specified in <code>RegexPatternString</code> is
/// invalid.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRegexPatternSet">REST API Reference for UpdateRegexPatternSet Operation</seealso>
public virtual UpdateRegexPatternSetResponse UpdateRegexPatternSet(UpdateRegexPatternSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRegexPatternSetResponseUnmarshaller.Instance;
return Invoke<UpdateRegexPatternSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateRegexPatternSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateRegexPatternSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRegexPatternSet">REST API Reference for UpdateRegexPatternSet Operation</seealso>
public virtual Task<UpdateRegexPatternSetResponse> UpdateRegexPatternSetAsync(UpdateRegexPatternSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRegexPatternSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRegexPatternSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateRegexPatternSetResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateRule
/// <summary>
/// Inserts or deletes <a>Predicate</a> objects in a <code>Rule</code>. Each <code>Predicate</code>
/// object identifies a predicate, such as a <a>ByteMatchSet</a> or an <a>IPSet</a>, that
/// specifies the web requests that you want to allow, block, or count. If you add more
/// than one predicate to a <code>Rule</code>, a request must match all of the specifications
/// to be allowed, blocked, or counted. For example, suppose that you add the following
/// to a <code>Rule</code>:
///
/// <ul> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches the value <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44</code>
/// </para>
/// </li> </ul>
/// <para>
/// You then add the <code>Rule</code> to a <code>WebACL</code> and specify that you want
/// to block requests that satisfy the <code>Rule</code>. For a request to be blocked,
/// the <code>User-Agent</code> header in the request must contain the value <code>BadBot</code>
/// <i>and</i> the request must originate from the IP address 192.0.2.44.
/// </para>
///
/// <para>
/// To create and configure a <code>Rule</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create the <code>Rule</code>. See <a>CreateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRule</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRule</code> request to add predicates to the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>Rule</code>. See <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// If you want to replace one <code>ByteMatchSet</code> or <code>IPSet</code> with another,
/// you delete the existing one and add the new one.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="ruleId">The <code>RuleId</code> of the <code>Rule</code> that you want to update. <code>RuleId</code> is returned by <code>CreateRule</code> and by <a>ListRules</a>.</param>
/// <param name="updates">An array of <code>RuleUpdate</code> objects that you want to insert into or delete from a <a>Rule</a>. For more information, see the applicable data types: <ul> <li> <a>RuleUpdate</a>: Contains <code>Action</code> and <code>Predicate</code> </li> <li> <a>Predicate</a>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code> </li> <li> <a>FieldToMatch</a>: Contains <code>Data</code> and <code>Type</code> </li> </ul></param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the UpdateRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRule">REST API Reference for UpdateRule Operation</seealso>
public virtual UpdateRuleResponse UpdateRule(string ruleId, List<RuleUpdate> updates, string changeToken)
{
var request = new UpdateRuleRequest();
request.RuleId = ruleId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateRule(request);
}
/// <summary>
/// Inserts or deletes <a>Predicate</a> objects in a <code>Rule</code>. Each <code>Predicate</code>
/// object identifies a predicate, such as a <a>ByteMatchSet</a> or an <a>IPSet</a>, that
/// specifies the web requests that you want to allow, block, or count. If you add more
/// than one predicate to a <code>Rule</code>, a request must match all of the specifications
/// to be allowed, blocked, or counted. For example, suppose that you add the following
/// to a <code>Rule</code>:
///
/// <ul> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches the value <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44</code>
/// </para>
/// </li> </ul>
/// <para>
/// You then add the <code>Rule</code> to a <code>WebACL</code> and specify that you want
/// to block requests that satisfy the <code>Rule</code>. For a request to be blocked,
/// the <code>User-Agent</code> header in the request must contain the value <code>BadBot</code>
/// <i>and</i> the request must originate from the IP address 192.0.2.44.
/// </para>
///
/// <para>
/// To create and configure a <code>Rule</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create the <code>Rule</code>. See <a>CreateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRule</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRule</code> request to add predicates to the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>Rule</code>. See <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// If you want to replace one <code>ByteMatchSet</code> or <code>IPSet</code> with another,
/// you delete the existing one and add the new one.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateRule service method.</param>
///
/// <returns>The response from the UpdateRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRule">REST API Reference for UpdateRule Operation</seealso>
public virtual UpdateRuleResponse UpdateRule(UpdateRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRuleResponseUnmarshaller.Instance;
return Invoke<UpdateRuleResponse>(request, options);
}
/// <summary>
/// Inserts or deletes <a>Predicate</a> objects in a <code>Rule</code>. Each <code>Predicate</code>
/// object identifies a predicate, such as a <a>ByteMatchSet</a> or an <a>IPSet</a>, that
/// specifies the web requests that you want to allow, block, or count. If you add more
/// than one predicate to a <code>Rule</code>, a request must match all of the specifications
/// to be allowed, blocked, or counted. For example, suppose that you add the following
/// to a <code>Rule</code>:
///
/// <ul> <li>
/// <para>
/// A <code>ByteMatchSet</code> that matches the value <code>BadBot</code> in the <code>User-Agent</code>
/// header
/// </para>
/// </li> <li>
/// <para>
/// An <code>IPSet</code> that matches the IP address <code>192.0.2.44</code>
/// </para>
/// </li> </ul>
/// <para>
/// You then add the <code>Rule</code> to a <code>WebACL</code> and specify that you want
/// to block requests that satisfy the <code>Rule</code>. For a request to be blocked,
/// the <code>User-Agent</code> header in the request must contain the value <code>BadBot</code>
/// <i>and</i> the request must originate from the IP address 192.0.2.44.
/// </para>
///
/// <para>
/// To create and configure a <code>Rule</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create the <code>Rule</code>. See <a>CreateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRule</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRule</code> request to add predicates to the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>Rule</code>. See <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// If you want to replace one <code>ByteMatchSet</code> or <code>IPSet</code> with another,
/// you delete the existing one and add the new one.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="ruleId">The <code>RuleId</code> of the <code>Rule</code> that you want to update. <code>RuleId</code> is returned by <code>CreateRule</code> and by <a>ListRules</a>.</param>
/// <param name="updates">An array of <code>RuleUpdate</code> objects that you want to insert into or delete from a <a>Rule</a>. For more information, see the applicable data types: <ul> <li> <a>RuleUpdate</a>: Contains <code>Action</code> and <code>Predicate</code> </li> <li> <a>Predicate</a>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code> </li> <li> <a>FieldToMatch</a>: Contains <code>Data</code> and <code>Type</code> </li> </ul></param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateRule service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRule">REST API Reference for UpdateRule Operation</seealso>
public virtual Task<UpdateRuleResponse> UpdateRuleAsync(string ruleId, List<RuleUpdate> updates, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new UpdateRuleRequest();
request.RuleId = ruleId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateRuleAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateRule operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRule">REST API Reference for UpdateRule Operation</seealso>
public virtual Task<UpdateRuleResponse> UpdateRuleAsync(UpdateRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRuleResponseUnmarshaller.Instance;
return InvokeAsync<UpdateRuleResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateRuleGroup
/// <summary>
/// Inserts or deletes <a>ActivatedRule</a> objects in a <code>RuleGroup</code>.
///
///
/// <para>
/// You can only insert <code>REGULAR</code> rules into a rule group.
/// </para>
///
/// <para>
/// You can have a maximum of ten rules per rule group.
/// </para>
///
/// <para>
/// To create and configure a <code>RuleGroup</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the <code>Rules</code> that you want to include in the <code>RuleGroup</code>.
/// See <a>CreateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateRuleGroup</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateRuleGroup</code> request to add <code>Rules</code> to the <code>RuleGroup</code>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update a <code>WebACL</code> that contains the <code>RuleGroup</code>.
/// See <a>CreateWebACL</a>.
/// </para>
/// </li> </ol>
/// <para>
/// If you want to replace one <code>Rule</code> with another, you delete the existing
/// one and add the new one.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateRuleGroup service method.</param>
///
/// <returns>The response from the UpdateRuleGroup service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRuleGroup">REST API Reference for UpdateRuleGroup Operation</seealso>
public virtual UpdateRuleGroupResponse UpdateRuleGroup(UpdateRuleGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRuleGroupResponseUnmarshaller.Instance;
return Invoke<UpdateRuleGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateRuleGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateRuleGroup operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRuleGroup">REST API Reference for UpdateRuleGroup Operation</seealso>
public virtual Task<UpdateRuleGroupResponse> UpdateRuleGroupAsync(UpdateRuleGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRuleGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRuleGroupResponseUnmarshaller.Instance;
return InvokeAsync<UpdateRuleGroupResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateSizeConstraintSet
/// <summary>
/// Inserts or deletes <a>SizeConstraint</a> objects (filters) in a <a>SizeConstraintSet</a>.
/// For each <code>SizeConstraint</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// Whether to insert or delete the object from the array. If you want to change a <code>SizeConstraintSetUpdate</code>
/// object, you delete the existing object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// The part of a web request that you want AWS WAF to evaluate, such as the length of
/// a query string or the length of the <code>User-Agent</code> header.
/// </para>
/// </li> <li>
/// <para>
/// Whether to perform any transformations on the request, such as converting it to lowercase,
/// before checking its length. Note that transformations of the request body are not
/// supported because the AWS resource forwards only the first <code>8192</code> bytes
/// of your request to AWS WAF.
/// </para>
///
/// <para>
/// You can only specify a single type of TextTransformation.
/// </para>
/// </li> <li>
/// <para>
/// A <code>ComparisonOperator</code> used for evaluating the selected part of the request
/// against the specified <code>Size</code>, such as equals, greater than, less than,
/// and so on.
/// </para>
/// </li> <li>
/// <para>
/// The length, in bytes, that you want AWS WAF to watch for in selected part of the request.
/// The length is computed after applying the transformation.
/// </para>
/// </li> </ul>
/// <para>
/// For example, you can add a <code>SizeConstraintSetUpdate</code> object that matches
/// web requests in which the length of the <code>User-Agent</code> header is greater
/// than 100 bytes. You can then configure AWS WAF to block those requests.
/// </para>
///
/// <para>
/// To create and configure a <code>SizeConstraintSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create a <code>SizeConstraintSet.</code> For more information, see <a>CreateSizeConstraintSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <code>UpdateSizeConstraintSet</code> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateSizeConstraintSet</code> request to specify the part of the
/// request that you want AWS WAF to inspect (for example, the header or the URI) and
/// the value that you want AWS WAF to watch for.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateSizeConstraintSet service method.</param>
///
/// <returns>The response from the UpdateSizeConstraintSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSizeConstraintSet">REST API Reference for UpdateSizeConstraintSet Operation</seealso>
public virtual UpdateSizeConstraintSetResponse UpdateSizeConstraintSet(UpdateSizeConstraintSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateSizeConstraintSetResponseUnmarshaller.Instance;
return Invoke<UpdateSizeConstraintSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateSizeConstraintSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateSizeConstraintSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSizeConstraintSet">REST API Reference for UpdateSizeConstraintSet Operation</seealso>
public virtual Task<UpdateSizeConstraintSetResponse> UpdateSizeConstraintSetAsync(UpdateSizeConstraintSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateSizeConstraintSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateSizeConstraintSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateSizeConstraintSetResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateSqlInjectionMatchSet
/// <summary>
/// Inserts or deletes <a>SqlInjectionMatchTuple</a> objects (filters) in a <a>SqlInjectionMatchSet</a>.
/// For each <code>SqlInjectionMatchTuple</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// <code>Action</code>: Whether to insert the object into or delete the object from
/// the array. To change a <code>SqlInjectionMatchTuple</code>, you delete the existing
/// object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// <code>FieldToMatch</code>: The part of web requests that you want AWS WAF to inspect
/// and, if you want AWS WAF to inspect a header or custom query parameter, the name of
/// the header or parameter.
/// </para>
/// </li> <li>
/// <para>
/// <code>TextTransformation</code>: Which text transformation, if any, to perform on
/// the web request before inspecting the request for snippets of malicious SQL code.
/// </para>
///
/// <para>
/// You can only specify a single type of TextTransformation.
/// </para>
/// </li> </ul>
/// <para>
/// You use <code>SqlInjectionMatchSet</code> objects to specify which CloudFront requests
/// that you want to allow, block, or count. For example, if you're receiving requests
/// that contain snippets of SQL code in the query string and you want to block the requests,
/// you can create a <code>SqlInjectionMatchSet</code> with the applicable settings, and
/// then configure AWS WAF to block the requests.
/// </para>
///
/// <para>
/// To create and configure a <code>SqlInjectionMatchSet</code>, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateSqlInjectionMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateSqlInjectionMatchSet</code> request to specify the parts of
/// web requests that you want AWS WAF to inspect for snippets of SQL code.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="sqlInjectionMatchSetId">The <code>SqlInjectionMatchSetId</code> of the <code>SqlInjectionMatchSet</code> that you want to update. <code>SqlInjectionMatchSetId</code> is returned by <a>CreateSqlInjectionMatchSet</a> and by <a>ListSqlInjectionMatchSets</a>.</param>
/// <param name="updates">An array of <code>SqlInjectionMatchSetUpdate</code> objects that you want to insert into or delete from a <a>SqlInjectionMatchSet</a>. For more information, see the applicable data types: <ul> <li> <a>SqlInjectionMatchSetUpdate</a>: Contains <code>Action</code> and <code>SqlInjectionMatchTuple</code> </li> <li> <a>SqlInjectionMatchTuple</a>: Contains <code>FieldToMatch</code> and <code>TextTransformation</code> </li> <li> <a>FieldToMatch</a>: Contains <code>Data</code> and <code>Type</code> </li> </ul></param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
///
/// <returns>The response from the UpdateSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSqlInjectionMatchSet">REST API Reference for UpdateSqlInjectionMatchSet Operation</seealso>
public virtual UpdateSqlInjectionMatchSetResponse UpdateSqlInjectionMatchSet(string sqlInjectionMatchSetId, List<SqlInjectionMatchSetUpdate> updates, string changeToken)
{
var request = new UpdateSqlInjectionMatchSetRequest();
request.SqlInjectionMatchSetId = sqlInjectionMatchSetId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateSqlInjectionMatchSet(request);
}
/// <summary>
/// Inserts or deletes <a>SqlInjectionMatchTuple</a> objects (filters) in a <a>SqlInjectionMatchSet</a>.
/// For each <code>SqlInjectionMatchTuple</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// <code>Action</code>: Whether to insert the object into or delete the object from
/// the array. To change a <code>SqlInjectionMatchTuple</code>, you delete the existing
/// object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// <code>FieldToMatch</code>: The part of web requests that you want AWS WAF to inspect
/// and, if you want AWS WAF to inspect a header or custom query parameter, the name of
/// the header or parameter.
/// </para>
/// </li> <li>
/// <para>
/// <code>TextTransformation</code>: Which text transformation, if any, to perform on
/// the web request before inspecting the request for snippets of malicious SQL code.
/// </para>
///
/// <para>
/// You can only specify a single type of TextTransformation.
/// </para>
/// </li> </ul>
/// <para>
/// You use <code>SqlInjectionMatchSet</code> objects to specify which CloudFront requests
/// that you want to allow, block, or count. For example, if you're receiving requests
/// that contain snippets of SQL code in the query string and you want to block the requests,
/// you can create a <code>SqlInjectionMatchSet</code> with the applicable settings, and
/// then configure AWS WAF to block the requests.
/// </para>
///
/// <para>
/// To create and configure a <code>SqlInjectionMatchSet</code>, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateSqlInjectionMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateSqlInjectionMatchSet</code> request to specify the parts of
/// web requests that you want AWS WAF to inspect for snippets of SQL code.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateSqlInjectionMatchSet service method.</param>
///
/// <returns>The response from the UpdateSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSqlInjectionMatchSet">REST API Reference for UpdateSqlInjectionMatchSet Operation</seealso>
public virtual UpdateSqlInjectionMatchSetResponse UpdateSqlInjectionMatchSet(UpdateSqlInjectionMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateSqlInjectionMatchSetResponseUnmarshaller.Instance;
return Invoke<UpdateSqlInjectionMatchSetResponse>(request, options);
}
/// <summary>
/// Inserts or deletes <a>SqlInjectionMatchTuple</a> objects (filters) in a <a>SqlInjectionMatchSet</a>.
/// For each <code>SqlInjectionMatchTuple</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// <code>Action</code>: Whether to insert the object into or delete the object from
/// the array. To change a <code>SqlInjectionMatchTuple</code>, you delete the existing
/// object and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// <code>FieldToMatch</code>: The part of web requests that you want AWS WAF to inspect
/// and, if you want AWS WAF to inspect a header or custom query parameter, the name of
/// the header or parameter.
/// </para>
/// </li> <li>
/// <para>
/// <code>TextTransformation</code>: Which text transformation, if any, to perform on
/// the web request before inspecting the request for snippets of malicious SQL code.
/// </para>
///
/// <para>
/// You can only specify a single type of TextTransformation.
/// </para>
/// </li> </ul>
/// <para>
/// You use <code>SqlInjectionMatchSet</code> objects to specify which CloudFront requests
/// that you want to allow, block, or count. For example, if you're receiving requests
/// that contain snippets of SQL code in the query string and you want to block the requests,
/// you can create a <code>SqlInjectionMatchSet</code> with the applicable settings, and
/// then configure AWS WAF to block the requests.
/// </para>
///
/// <para>
/// To create and configure a <code>SqlInjectionMatchSet</code>, perform the following
/// steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateSqlInjectionMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateSqlInjectionMatchSet</code> request to specify the parts of
/// web requests that you want AWS WAF to inspect for snippets of SQL code.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="sqlInjectionMatchSetId">The <code>SqlInjectionMatchSetId</code> of the <code>SqlInjectionMatchSet</code> that you want to update. <code>SqlInjectionMatchSetId</code> is returned by <a>CreateSqlInjectionMatchSet</a> and by <a>ListSqlInjectionMatchSets</a>.</param>
/// <param name="updates">An array of <code>SqlInjectionMatchSetUpdate</code> objects that you want to insert into or delete from a <a>SqlInjectionMatchSet</a>. For more information, see the applicable data types: <ul> <li> <a>SqlInjectionMatchSetUpdate</a>: Contains <code>Action</code> and <code>SqlInjectionMatchTuple</code> </li> <li> <a>SqlInjectionMatchTuple</a>: Contains <code>FieldToMatch</code> and <code>TextTransformation</code> </li> <li> <a>FieldToMatch</a>: Contains <code>Data</code> and <code>Type</code> </li> </ul></param>
/// <param name="changeToken">The value returned by the most recent call to <a>GetChangeToken</a>.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateSqlInjectionMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSqlInjectionMatchSet">REST API Reference for UpdateSqlInjectionMatchSet Operation</seealso>
public virtual Task<UpdateSqlInjectionMatchSetResponse> UpdateSqlInjectionMatchSetAsync(string sqlInjectionMatchSetId, List<SqlInjectionMatchSetUpdate> updates, string changeToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var request = new UpdateSqlInjectionMatchSetRequest();
request.SqlInjectionMatchSetId = sqlInjectionMatchSetId;
request.Updates = updates;
request.ChangeToken = changeToken;
return UpdateSqlInjectionMatchSetAsync(request, cancellationToken);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateSqlInjectionMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateSqlInjectionMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSqlInjectionMatchSet">REST API Reference for UpdateSqlInjectionMatchSet Operation</seealso>
public virtual Task<UpdateSqlInjectionMatchSetResponse> UpdateSqlInjectionMatchSetAsync(UpdateSqlInjectionMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateSqlInjectionMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateSqlInjectionMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateSqlInjectionMatchSetResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateWebACL
/// <summary>
/// Inserts or deletes <a>ActivatedRule</a> objects in a <code>WebACL</code>. Each <code>Rule</code>
/// identifies web requests that you want to allow, block, or count. When you update a
/// <code>WebACL</code>, you specify the following values:
///
/// <ul> <li>
/// <para>
/// A default action for the <code>WebACL</code>, either <code>ALLOW</code> or <code>BLOCK</code>.
/// AWS WAF performs the default action if a request doesn't match the criteria in any
/// of the <code>Rules</code> in a <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// The <code>Rules</code> that you want to add or delete. If you want to replace one
/// <code>Rule</code> with another, you delete the existing <code>Rule</code> and add
/// the new one.
/// </para>
/// </li> <li>
/// <para>
/// For each <code>Rule</code>, whether you want AWS WAF to allow requests, block requests,
/// or count requests that match the conditions in the <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// The order in which you want AWS WAF to evaluate the <code>Rules</code> in a <code>WebACL</code>.
/// If you add more than one <code>Rule</code> to a <code>WebACL</code>, AWS WAF evaluates
/// each request against the <code>Rules</code> in order based on the value of <code>Priority</code>.
/// (The <code>Rule</code> that has the lowest value for <code>Priority</code> is evaluated
/// first.) When a web request matches all the predicates (such as <code>ByteMatchSets</code>
/// and <code>IPSets</code>) in a <code>Rule</code>, AWS WAF immediately takes the corresponding
/// action, allow or block, and doesn't evaluate the request against the remaining <code>Rules</code>
/// in the <code>WebACL</code>, if any.
/// </para>
/// </li> </ul>
/// <para>
/// To create and configure a <code>WebACL</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Create and update the predicates that you want to include in <code>Rules</code>. For
/// more information, see <a>CreateByteMatchSet</a>, <a>UpdateByteMatchSet</a>, <a>CreateIPSet</a>,
/// <a>UpdateIPSet</a>, <a>CreateSqlInjectionMatchSet</a>, and <a>UpdateSqlInjectionMatchSet</a>.
/// </para>
/// </li> <li>
/// <para>
/// Create and update the <code>Rules</code> that you want to include in the <code>WebACL</code>.
/// For more information, see <a>CreateRule</a> and <a>UpdateRule</a>.
/// </para>
/// </li> <li>
/// <para>
/// Create a <code>WebACL</code>. See <a>CreateWebACL</a>.
/// </para>
/// </li> <li>
/// <para>
/// Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateWebACL</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateWebACL</code> request to specify the <code>Rules</code> that
/// you want to include in the <code>WebACL</code>, to specify the default action, and
/// to associate the <code>WebACL</code> with a CloudFront distribution.
/// </para>
///
/// <para>
/// The <code>ActivatedRule</code> can be a rule group. If you specify a rule group as
/// your <code>ActivatedRule</code>, you can exclude specific rules from that rule group.
/// </para>
///
/// <para>
/// If you already have a rule group associated with a web ACL and want to submit an <code>UpdateWebACL</code>
/// request to exclude certain rules from that rule group, you must first remove the rule
/// group from the web ACL, the re-insert it again, specifying the excluded rules. For
/// details, see <a>ActivatedRule$ExcludedRules</a>.
/// </para>
/// </li> </ol>
/// <para>
/// Be aware that if you try to add a RATE_BASED rule to a web ACL without setting the
/// rule type when first creating the rule, the <a>UpdateWebACL</a> request will fail
/// because the request tries to add a REGULAR rule (the default rule type) with the specified
/// ID, which does not exist.
/// </para>
///
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateWebACL service method.</param>
///
/// <returns>The response from the UpdateWebACL service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFReferencedItemException">
/// The operation failed because you tried to delete an object that is still in use. For
/// example:
///
/// <ul> <li>
/// <para>
/// You tried to delete a <code>ByteMatchSet</code> that is still referenced by a <code>Rule</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to delete a <code>Rule</code> that is still referenced by a <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFSubscriptionNotFoundException">
/// The specified subscription does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateWebACL">REST API Reference for UpdateWebACL Operation</seealso>
public virtual UpdateWebACLResponse UpdateWebACL(UpdateWebACLRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateWebACLResponseUnmarshaller.Instance;
return Invoke<UpdateWebACLResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateWebACL operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateWebACL operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateWebACL">REST API Reference for UpdateWebACL Operation</seealso>
public virtual Task<UpdateWebACLResponse> UpdateWebACLAsync(UpdateWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateWebACLRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateWebACLResponseUnmarshaller.Instance;
return InvokeAsync<UpdateWebACLResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateXssMatchSet
/// <summary>
/// Inserts or deletes <a>XssMatchTuple</a> objects (filters) in an <a>XssMatchSet</a>.
/// For each <code>XssMatchTuple</code> object, you specify the following values:
///
/// <ul> <li>
/// <para>
/// <code>Action</code>: Whether to insert the object into or delete the object from
/// the array. To change an <code>XssMatchTuple</code>, you delete the existing object
/// and add a new one.
/// </para>
/// </li> <li>
/// <para>
/// <code>FieldToMatch</code>: The part of web requests that you want AWS WAF to inspect
/// and, if you want AWS WAF to inspect a header or custom query parameter, the name of
/// the header or parameter.
/// </para>
/// </li> <li>
/// <para>
/// <code>TextTransformation</code>: Which text transformation, if any, to perform on
/// the web request before inspecting the request for cross-site scripting attacks.
/// </para>
///
/// <para>
/// You can only specify a single type of TextTransformation.
/// </para>
/// </li> </ul>
/// <para>
/// You use <code>XssMatchSet</code> objects to specify which CloudFront requests that
/// you want to allow, block, or count. For example, if you're receiving requests that
/// contain cross-site scripting attacks in the request body and you want to block the
/// requests, you can create an <code>XssMatchSet</code> with the applicable settings,
/// and then configure AWS WAF to block the requests.
/// </para>
///
/// <para>
/// To create and configure an <code>XssMatchSet</code>, perform the following steps:
/// </para>
/// <ol> <li>
/// <para>
/// Submit a <a>CreateXssMatchSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Use <a>GetChangeToken</a> to get the change token that you provide in the <code>ChangeToken</code>
/// parameter of an <a>UpdateIPSet</a> request.
/// </para>
/// </li> <li>
/// <para>
/// Submit an <code>UpdateXssMatchSet</code> request to specify the parts of web requests
/// that you want AWS WAF to inspect for cross-site scripting attacks.
/// </para>
/// </li> </ol>
/// <para>
/// For more information about how to use the AWS WAF API to allow or block HTTP requests,
/// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer
/// Guide</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateXssMatchSet service method.</param>
///
/// <returns>The response from the UpdateXssMatchSet service method, as returned by WAF.</returns>
/// <exception cref="Amazon.WAF.Model.WAFInternalErrorException">
/// The operation failed because of a system problem, even though the request was valid.
/// Retry your request.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidAccountException">
/// The operation failed because you tried to create, update, or delete an object by using
/// an invalid account identifier.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidOperationException">
/// The operation failed because there was nothing to do. For example:
///
/// <ul> <li>
/// <para>
/// You tried to remove a <code>Rule</code> from a <code>WebACL</code>, but the <code>Rule</code>
/// isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove an IP address from an <code>IPSet</code>, but the IP address isn't
/// in the specified <code>IPSet</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to remove a <code>ByteMatchTuple</code> from a <code>ByteMatchSet</code>,
/// but the <code>ByteMatchTuple</code> isn't in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>Rule</code> to a <code>WebACL</code>, but the <code>Rule</code>
/// already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to a <code>ByteMatchSet</code>, but
/// the <code>ByteMatchTuple</code> already exists in the specified <code>WebACL</code>.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFInvalidParameterException">
/// The operation failed because AWS WAF didn't recognize a parameter in the request.
/// For example:
///
/// <ul> <li>
/// <para>
/// You specified an invalid parameter name.
/// </para>
/// </li> <li>
/// <para>
/// You specified an invalid value.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update an object (<code>ByteMatchSet</code>, <code>IPSet</code>, <code>Rule</code>,
/// or <code>WebACL</code>) using an action other than <code>INSERT</code> or <code>DELETE</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>WebACL</code> with a <code>DefaultAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to create a <code>RateBasedRule</code> with a <code>RateKey</code> value
/// other than <code>IP</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>WebACL</code> with a <code>WafAction</code> <code>Type</code>
/// other than <code>ALLOW</code>, <code>BLOCK</code>, or <code>COUNT</code>.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>FieldToMatch</code> <code>Type</code>
/// other than HEADER, METHOD, QUERY_STRING, URI, or BODY.
/// </para>
/// </li> <li>
/// <para>
/// You tried to update a <code>ByteMatchSet</code> with a <code>Field</code> of <code>HEADER</code>
/// but no value for <code>Data</code>.
/// </para>
/// </li> <li>
/// <para>
/// Your request references an ARN that is malformed, or corresponds to a resource with
/// which a web ACL cannot be associated.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFLimitsExceededException">
/// The operation exceeds a resource limit, for example, the maximum number of <code>WebACL</code>
/// objects that you can create for an AWS account. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">Limits</a>
/// in the <i>AWS WAF Developer Guide</i>.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentContainerException">
/// The operation failed because you tried to add an object to or delete an object from
/// another object that doesn't exist. For example:
///
/// <ul> <li>
/// <para>
/// You tried to add a <code>Rule</code> to or delete a <code>Rule</code> from a <code>WebACL</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchSet</code> to or delete a <code>ByteMatchSet</code>
/// from a <code>Rule</code> that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add an IP address to or delete an IP address from an <code>IPSet</code>
/// that doesn't exist.
/// </para>
/// </li> <li>
/// <para>
/// You tried to add a <code>ByteMatchTuple</code> to or delete a <code>ByteMatchTuple</code>
/// from a <code>ByteMatchSet</code> that doesn't exist.
/// </para>
/// </li> </ul>
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFNonexistentItemException">
/// The operation failed because the referenced object doesn't exist.
/// </exception>
/// <exception cref="Amazon.WAF.Model.WAFStaleDataException">
/// The operation failed because you tried to create, update, or delete an object by using
/// a change token that has already been used.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateXssMatchSet">REST API Reference for UpdateXssMatchSet Operation</seealso>
public virtual UpdateXssMatchSetResponse UpdateXssMatchSet(UpdateXssMatchSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateXssMatchSetResponseUnmarshaller.Instance;
return Invoke<UpdateXssMatchSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateXssMatchSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateXssMatchSet operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateXssMatchSet">REST API Reference for UpdateXssMatchSet Operation</seealso>
public virtual Task<UpdateXssMatchSetResponse> UpdateXssMatchSetAsync(UpdateXssMatchSetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateXssMatchSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateXssMatchSetResponseUnmarshaller.Instance;
return InvokeAsync<UpdateXssMatchSetResponse>(request, options, cancellationToken);
}
#endregion
}
} | 51.259517 | 578 | 0.60021 | [
"Apache-2.0"
] | FoxBearBear/aws-sdk-net | sdk/src/Services/WAF/Generated/_bcl45/AmazonWAFClient.cs | 632,850 | C# |
using System.Net;
using NUnit.Framework;
[SetUpFixture]
public class InitializeTests
{
[OneTimeSetUp]
public void OneTimeSetUp()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
}
}
| 21.846154 | 130 | 0.75 | [
"Apache-2.0"
] | ClaudineL/ZendeskApi_v2 | test/ZendeskApi_v2.Test/InitializeTests.cs | 286 | C# |
using Moq;
using NUnit.Framework;
using System;
using TravelGuide.Data;
using TravelGuide.Models.Articles;
using TravelGuide.Services.Articles;
using TravelGuide.Services.Factories;
namespace TravelGuide.Tests.Services.Articles.ArticleServiceTests
{
[TestFixture]
public class DeleteComment_Should
{
[Test]
[TestCase(null)]
[TestCase("")]
public void ThrowArgumentNullException_WhenPassedIdIsNull(string id)
{
// Arrange
var contextMock = new Mock<ITravelGuideContext>();
var factoryMock = new Mock<IArticleFactory>();
var commentFactoryMock = new Mock<IArticleCommentFactory>();
var service = new ArticleService(contextMock.Object, factoryMock.Object, commentFactoryMock.Object);
// Act & Assert
Assert.Throws<ArgumentNullException>(() => service.DeleteComment(id));
}
[Test]
public void ThrowInvalidOperationException_WhenNoSuchCommentIsFound()
{
// Arrange
var contextMock = new Mock<ITravelGuideContext>();
var factoryMock = new Mock<IArticleFactory>();
var commentFactoryMock = new Mock<IArticleCommentFactory>();
contextMock.Setup(x => x.Comments.Find(It.IsAny<Guid>())).Returns((ArticleComment)null);
var service = new ArticleService(contextMock.Object, factoryMock.Object, commentFactoryMock.Object);
// Act & Assert
Assert.Throws<InvalidOperationException>(() => service.DeleteComment(Guid.NewGuid().ToString()));
}
[Test]
public void CallRemoveMethod_WhenPassedValidParams()
{
// Arrange
var contextMock = new Mock<ITravelGuideContext>();
var factoryMock = new Mock<IArticleFactory>();
var commentFactoryMock = new Mock<IArticleCommentFactory>();
var comment = new ArticleComment();
contextMock.Setup(x => x.Comments.Find(It.IsAny<Guid>())).Returns(comment);
var service = new ArticleService(contextMock.Object, factoryMock.Object, commentFactoryMock.Object);
// Act
service.DeleteComment(Guid.NewGuid().ToString());
// Assert
contextMock.Verify(x => x.Comments.Remove(comment), Times.Once);
}
}
}
| 36.292308 | 112 | 0.640526 | [
"MIT"
] | dimitar-pechev/TravelGuide | TravelGuide.Tests/Services/Articles/ArticleServiceTests/DeleteComment_Should.cs | 2,361 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
/*
* Do not modify this file. This file is generated from the ec2-2016-11-15.normal.json service model.
*/
using System;
using Amazon.Runtime;
using Amazon.Util.Internal;
namespace Amazon.EC2
{
/// <summary>
/// Configuration for accessing Amazon EC2 service
/// </summary>
public partial class AmazonEC2Config : ClientConfig
{
private static readonly string UserAgentString =
InternalSDKUtils.BuildUserAgentString("3.3.134.3");
private string _userAgent = UserAgentString;
/// <summary>
/// Default constructor
/// </summary>
public AmazonEC2Config()
{
this.AuthenticationServiceName = "ec2";
}
/// <summary>
/// The constant used to lookup in the region hash the endpoint.
/// </summary>
public override string RegionEndpointServiceName
{
get
{
return "ec2";
}
}
/// <summary>
/// Gets the ServiceVersion property.
/// </summary>
public override string ServiceVersion
{
get
{
return "2016-11-15";
}
}
/// <summary>
/// Gets the value of UserAgent property.
/// </summary>
public override string UserAgent
{
get
{
return _userAgent;
}
}
}
} | 25.675 | 101 | 0.579844 | [
"Apache-2.0"
] | tap4fun/aws-sdk-net | sdk/src/Services/EC2/Generated/AmazonEC2Config.cs | 2,054 | C# |
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace DougKlassen.Revit.Perfect.Interface
{
/// <summary>
/// Wrapper class for an object that tracks whether it is selected by the user and provides
/// properties to be bound to the controls of the SelectObjectsWindow
/// </summary>
public class ObjectSelection : IComparable
{
/// <summary>
/// Create an instance of ObjectSelection
/// </summary>
/// <param name="obj">The object to be encapsulated</param>
/// <param name="objectSelected">Whether the object has been selected</param>
public ObjectSelection(Object obj, Boolean objectSelected)
{
Value = obj;
IsSelected = objectSelected;
}
/// <summary>
/// Whether the object is selected, to be bound to the IsChecked property of the Checkbox
/// </summary>
public Boolean IsSelected { get; set; }
/// <summary>
/// The object encapsulated in the ObjectSelection
/// </summary>
public Object Value { get; set; }
/// <summary>
/// An encapsulation of Object.ToString() for use in binding as the text of the Checkbox
/// </summary>
public String Description
{
get
{
return Value.ToString();
}
}
/// <summary>
/// Use ToString() as the basis of CompareTo()
/// </summary>
/// <param name="obj"></param>
/// <returns>The value of the ToString() comparison</returns>
public int CompareTo(object obj)
{
return Description.CompareTo(obj.ToString());
}
}
/// <summary>
/// Interaction logic for SelectTagsWindow.xaml
/// </summary>
public partial class SelectObjectsWindow : Window
{
/// <summary>
/// Create a new window representing a collection of objects
/// </summary>
/// <param name="objects">The collection of objects</param>
/// <param name="selectAll">Whether all objects are checked by default</param>
public SelectObjectsWindow(List<Object> objects, Boolean selectAll)
: this(objects, selectAll, null, null)
{
}
/// <summary>
/// Create a new window representing a collection of objects
/// </summary>
/// <param name="objects"></param>
/// <param name="selectAll"></param>
/// <param name="title"></param>
public SelectObjectsWindow(
IEnumerable<Object> objects,
Boolean selectAll,
String title,
String message)
{
ObjectList = new List<ObjectSelection>();
foreach (Object obj in objects)
{
ObjectList.Add(new ObjectSelection(obj, selectAll));
}
ObjectList.Sort();
if (title != null)
{
Title = title;
}
if (String.IsNullOrWhiteSpace(message))
{
instructionsTextBlock.Visibility = Visibility.Collapsed;
}
else
{
Instructions = message;
}
InitializeComponent();
}
/// <summary>
/// The object that the user has been prompted to select from
/// </summary>
public List<ObjectSelection> ObjectList
{
get;
set;
}
/// <summary>
/// All the tags that are currently selected in the window by the user by checking their CheckBox
/// </summary>
public List<Object> SelectedObjects
{
get
{
List<Object> selectedObjects = new List<Object>();
foreach (ObjectSelection obj in ObjectList)
{
if (obj.IsSelected)
{
selectedObjects.Add(obj.Value);
}
}
return selectedObjects;
}
}
/// <summary>
/// The instructional message displayed at the top of the dialog
/// </summary>
public String Instructions
{
get;
set;
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
Close();
}
private void OkButton_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
Close();
}
private void allButton_Click(object sender, RoutedEventArgs e)
{
foreach (var item in tagListBox.Items)
{
CheckBox checkBox = GetCheckboxControl(item);
checkBox.IsChecked = true;
}
}
private void noneButton_Click(object sender, RoutedEventArgs e)
{
foreach (Object item in tagListBox.Items)
{
CheckBox checkBox = GetCheckboxControl(item);
checkBox.IsChecked = false;
}
}
/// <summary>
/// Access the CheckBox defined by the DataTemplate of the list Item
/// </summary>
/// <param name="sourceObject">A list Item contraining a CheckBox created by a DataTemplate</param>
/// <returns>The CheckBox control</returns>
private CheckBox GetCheckboxControl(Object sourceObject)
{
CheckBox checkBox;
DependencyObject listItem = tagListBox.ItemContainerGenerator.ContainerFromItem(sourceObject);
ContentPresenter presenter = FindVisualChild<ContentPresenter>(listItem);
DataTemplate template = presenter.ContentTemplate;
checkBox = template.FindName("selectCheckBox", presenter) as CheckBox;
return checkBox;
}
/// <summary>
/// Find a child of an element of the specified type
/// </summary>
/// <typeparam name="childItem">The type of the child to look for</typeparam>
/// <param name="parent">The parent element to search</param>
/// <returns>The specified child of the parent element</returns>
private childItem FindVisualChild<childItem>(DependencyObject parent)
where childItem : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(parent, i);
if (child != null && child is childItem)
{
return child as childItem;
}
else
{
childItem childOfChild = FindVisualChild<childItem>(child);
if (childOfChild != null)
{
return childOfChild;
}
}
}
return null;
}
}
}
| 32.463636 | 107 | 0.535564 | [
"Apache-2.0",
"MIT"
] | dougklassen/Revit-Perfect | Perfect/Perfect/Interface/SelectObjectsWindow.xaml.cs | 7,144 | C# |
#region BSD License
/*
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE.md file or at
* https://github.com/Wagnerp/Krypton-Toolkit-Suite-Extended-NET-5.471/blob/master/LICENSE
*
*/
#endregion
using ComponentFactory.Krypton.Toolkit;
using System.ComponentModel;
using System.Drawing;
namespace ExtendedControls.ExtendedToolkit.Controls.KryptonControls.Components
{
[ToolboxItem(true)]
[ToolboxBitmap(typeof(KryptonMessageBox))]
public class KryptonMessageboxComponent : Component
{
}
} | 26.619048 | 90 | 0.765653 | [
"BSD-3-Clause"
] | Krypton-Suite-Legacy/Krypton-Toolkit-Suite-Extended-NET-5.471 | Source/Krypton Toolkit Suite Extended/Full Toolkit/Extended Controls/ExtendedToolkit/Controls/Experimental/KryptonMessageboxComponent.cs | 561 | C# |
using CoreRPC.Binding;
using CoreRPC.Binding.Default;
using CoreRPC.CodeGen;
using CoreRPC.Routing;
using CoreRPC.Serialization;
using CoreRPC.Transport;
namespace CoreRPC
{
public class Engine
{
private readonly IMethodBinder _binder;
private readonly IMethodCallSerializer _serializer;
public Engine (IMethodCallSerializer serializer, IMethodBinder binder)
{
_binder = binder;
_serializer = serializer;
}
public Engine()
: this(new JsonMethodCallSerializer(false), new DefaultMethodBinder())
{
}
public IRequestHandler CreateRequestHandler(ITargetSelector selector, IRequestErrorHandler errors = null)
{
return new RequestHandler(selector, _binder, _serializer, null, errors);
}
public IRequestHandler CreateRequestHandler(
ITargetSelector selector,
IMethodCallInterceptor interceptor,
IRequestErrorHandler errors = null)
{
return new RequestHandler(selector, _binder, _serializer, interceptor, errors);
}
public TInterface CreateProxy<TInterface>(IClientTransport transport, ITargetNameExtractor nameExtractor = null)
{
if (nameExtractor == null)
nameExtractor = new DefaultTargetNameExtractor();
return ProxyGen.CreateInstance<TInterface>(new CallProxy(transport, _serializer,
_binder, nameExtractor.GetTargetName(typeof (TInterface))));
}
}
}
| 32.36 | 129 | 0.639679 | [
"MIT"
] | kekekeks/AsyncRpc | CoreRPC/Engine.cs | 1,620 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNative.Web.V20201001.Outputs
{
/// <summary>
/// The IIS handler mappings used to define which handler processes HTTP requests with certain extension.
/// For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension.
/// </summary>
[OutputType]
public sealed class HandlerMappingResponse
{
/// <summary>
/// Command-line arguments to be passed to the script processor.
/// </summary>
public readonly string? Arguments;
/// <summary>
/// Requests with this extension will be handled using the specified FastCGI application.
/// </summary>
public readonly string? Extension;
/// <summary>
/// The absolute path to the FastCGI application.
/// </summary>
public readonly string? ScriptProcessor;
[OutputConstructor]
private HandlerMappingResponse(
string? arguments,
string? extension,
string? scriptProcessor)
{
Arguments = arguments;
Extension = extension;
ScriptProcessor = scriptProcessor;
}
}
}
| 31.914894 | 114 | 0.641333 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/Web/V20201001/Outputs/HandlerMappingResponse.cs | 1,500 | C# |
using System;
using System.IO;
namespace ICSharpCode.SharpZipLib.Zip
{
public interface IDynamicDataSource
{
Stream GetSource(ZipEntry entry, string name);
}
}
| 15.090909 | 48 | 0.777108 | [
"MIT"
] | moto2002/jiandangjianghu | src/ICSharpCode.SharpZipLib.Zip/IDynamicDataSource.cs | 166 | C# |
using System;
using System.Threading.Tasks;
namespace Dex.Lock.Async
{
public interface IAsyncLock<T> where T : IDisposable
{
/// <summary>
/// Take async lock, return after lock is taken
/// </summary>
/// <returns></returns>
ValueTask<T> LockAsync();
}
} | 22.142857 | 56 | 0.587097 | [
"MIT"
] | dex-it/dex-common | src/Dex.Lock/Dex.Lock/Async/IAsyncLock.cs | 312 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WGApi
{
public enum Region
{
eu,
com,
ru,
asia
}
}
| 13.117647 | 33 | 0.609865 | [
"MIT"
] | chipsi007/wg-api-wrapper | WGApiClient/Enums/Region.cs | 225 | C# |
// Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Dolittle.Runtime.Services;
namespace Dolittle.Runtime.Management
{
/// <summary>
/// Represents a <see cref="IRepresentServiceType">service type</see> that is for management communication.
/// </summary>
/// <remarks>
/// Management is considered the channel where tooling is connecting for management.
/// </remarks>
public class ManagementServiceType : IRepresentServiceType
{
/// <summary>
/// Gets the identifying name for the <see cref="ManagementServiceType"/>.
/// </summary>
public const string Name = "Management";
/// <inheritdoc/>
public ServiceType Identifier => Name;
/// <inheritdoc/>
public Type BindingInterface => typeof(ICanBindManagementServices);
/// <inheritdoc/>
public EndpointVisibility Visibility => EndpointVisibility.Management;
}
} | 33.870968 | 111 | 0.672381 | [
"MIT"
] | dolittle/Runtime | Source/Management/ManagementServiceType.cs | 1,050 | C# |
using System;
using System.IO;
using System.Runtime.InteropServices;
using Imagini.Drawing;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
namespace Imagini.ImageSharp
{
/// <summary>
/// Contains various Graphics-related extensions.
/// </summary>
public static class GraphicsExtensions
{
/// <summary>
/// Saves the graphics to the specified stream.
/// </summary>
public static void SaveAsPng(this Graphics graphics, Stream stream) =>
graphics.Save(image => image.SaveAsPng(stream));
/// <summary>
/// Saves the graphics to the specified file, overwriting it if it exists.
/// </summary>
public static void SaveAsPng(this Graphics graphics, string path)
{
using (var stream = new FileStream(path, FileMode.Create))
graphics.SaveAsPng(stream);
}
/// <summary>
/// Saves the graphics using the specified save action.
/// </summary>
/// <example>
/// graphics.Save(image => image.SaveAsJpeg("file.jpg"))
/// </example>
public static void Save(this Graphics graphics,
Action<Image<Rgba32>> onSave)
{
var targetFormat = PixelFormat.Format_ABGR8888;
var size = graphics.OutputSize;
var pixelData = new ColorRGB888[graphics.PixelCount];
graphics.ReadPixels(ref pixelData);
var pixelHandle = GCHandle.Alloc(pixelData, GCHandleType.Pinned);
try
{
var image = new Image<Rgba32>(size.Width, size.Height);
unsafe
{
fixed (void* target = &MemoryMarshal.GetReference(image.GetPixelSpan()))
{
Pixels.Convert(size.Width, size.Height,
4 * size.Width, 4 * size.Width,
PixelFormat.Format_RGB888,
targetFormat,
pixelHandle.AddrOfPinnedObject(),
(IntPtr)target);
}
}
onSave(image);
image.Dispose();
}
finally
{
pixelHandle.Free();
}
}
}
} | 34.463768 | 92 | 0.533642 | [
"MIT"
] | project-grove/imagini | Imagini.ImageSharp/GraphicsExtensions.cs | 2,378 | C# |
using System.Threading.Tasks;
namespace Algenic.Commons
{
public interface IQueryHandler<in TQuery, TResult>
{
Task<TResult> HandleAsync(TQuery query);
}
}
| 17.8 | 54 | 0.696629 | [
"BSD-3-Clause"
] | marax27/Algenic | Algenic.Commons/IQueryHandler.cs | 180 | C# |
using System;
using System.Xml.Serialization;
namespace Aop.Api.Domain
{
/// <summary>
/// AssetFundInfo Data Structure.
/// </summary>
[Serializable]
public class AssetFundInfo : AopObject
{
/// <summary>
/// 创建权益模板的金额,创建权益模板时需要指定实际金额,单元是元
/// </summary>
[XmlElement("amount")]
public string Amount { get; set; }
/// <summary>
/// 出资账号,创建权益模板时可以指定出资的账号,比如如果使用集分宝积分库出资,填入积分库id即1035,可以在pointmng上查询商家的积分库id。如果为空,则默认根据商家在云合约产品下的积分库出资
/// </summary>
[XmlElement("fund_account")]
public string FundAccount { get; set; }
/// <summary>
/// 出资账号类型,创建权益模板时需要指明账号的类型,由支付宝权益结算平台定义,比如POINT_LIB表示由集分宝积分库出资,其他值的获取请咨询相关开发同学。如果为空,则默认从集分宝积分库出资
/// </summary>
[XmlElement("fund_type")]
public string FundType { get; set; }
/// <summary>
/// 结算截止时间,表示权益模板进行结算的最终时间,可以是相对模板过期时间基础上增加的时间也可以是绝对时间,相对时间:2d表示相对模板过期增加2天,10h表示增加10个小时,5m表示增加5分钟,绝对时间的格式为: yyyy-MM-dd HH:mm:ss
/// </summary>
[XmlElement("settle_dead_line")]
public string SettleDeadLine { get; set; }
/// <summary>
/// 结算方式,表示这个模板进行结算时候的结算方式(实时结算、按天结算等等),“T1”表示按天结算,由支付宝权益结算平台定义
/// </summary>
[XmlElement("settle_mode")]
public string SettleMode { get; set; }
}
}
| 32.023256 | 136 | 0.598402 | [
"Apache-2.0"
] | 554393109/alipay-sdk-net-all | AlipaySDKNet.Standard/Domain/AssetFundInfo.cs | 2,067 | C# |
using CoreGraphics;
using Microsoft.Maui.Controls.Internals;
#if __MOBILE__
using UIKit;
namespace Microsoft.Maui.Controls.Compatibility.Platform.iOS
#else
using UIView = AppKit.NSView;
namespace Microsoft.Maui.Controls.Compatibility.Platform.MacOS
#endif
{
public class NativeViewWrapperRenderer : ViewRenderer<NativeViewWrapper, UIView>
{
[Microsoft.Maui.Controls.Internals.Preserve(Conditional = true)]
public NativeViewWrapperRenderer()
{
}
public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
{
if (Element?.GetDesiredSizeDelegate == null)
return base.GetDesiredSize(widthConstraint, heightConstraint);
// The user has specified a different implementation of GetDesiredSize
var result = Element.GetDesiredSizeDelegate(this, widthConstraint, heightConstraint);
// If the GetDesiredSize delegate returns a SizeRequest, we use it; if it returns null,
// fall back to the default implementation
return result ?? base.GetDesiredSize(widthConstraint, heightConstraint);
}
#if __MOBILE__
public override void LayoutSubviews()
{
if (Element?.LayoutSubViews == null)
{
((IVisualElementController)Element)?.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
base.LayoutSubviews();
return;
}
// The user has specified a different implementation of LayoutSubviews
var handled = Element.LayoutSubViews();
if (!handled)
{
// If the delegate wasn't able to handle the request, fall back to the default implementation
base.LayoutSubviews();
}
}
public override CGSize SizeThatFits(CGSize size)
{
if (Element?.SizeThatFitsDelegate == null)
return base.SizeThatFits(size);
// The user has specified a different implementation of SizeThatFits
var result = Element.SizeThatFitsDelegate(size);
// If the delegate returns a value, we use it;
// if it returns null, fall back to the default implementation
return result ?? base.SizeThatFits(size);
}
#else
public override void Layout()
{
if (Element?.LayoutSubViews == null)
{
((IVisualElementController)Element)?.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
base.Layout();
return;
}
// The user has specified a different implementation of LayoutSubviews
var handled = Element.LayoutSubViews();
if (!handled)
{
// If the delegate wasn't able to handle the request, fall back to the default implementation
base.Layout();
}
}
#endif
protected override void OnElementChanged(ElementChangedEventArgs<NativeViewWrapper> e)
{
base.OnElementChanged(e);
if (e.OldElement == null)
SetNativeControl(Element.NativeView);
}
/// <summary>
/// The native control we're wrapping isn't ours to dispose of
/// </summary>
protected override bool ManageNativeControlLifetime => false;
}
} | 28.909091 | 97 | 0.740741 | [
"MIT"
] | Amir-Hossin-pr/maui | src/Compatibility/Core/src/iOS/NativeViewWrapperRenderer.cs | 2,862 | C# |
namespace ET
{
public class Darius_R_CollisionHandler: AB2S_CollisionHandler
{
public override void HandleCollisionStart(Unit a, Unit b)
{
throw new System.NotImplementedException();
}
public override void HandleCollisionSustain(Unit a, Unit b)
{
throw new System.NotImplementedException();
}
public override void HandleCollisionEnd(Unit a, Unit b)
{
throw new System.NotImplementedException();
}
}
} | 26.15 | 67 | 0.617591 | [
"MIT"
] | futouyiba/ClubET | Server/Hotfix/NKGMOBA/Battle/Box2D/CollisionHandler/Darius_R_CollisionHandler.cs | 525 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using AutoRest.Core.Model;
using AutoRest.Core.Utilities;
using AutoRest.Extensions;
namespace AutoRest.Ruby.Model
{
/// <summary>
/// The model object for regular Ruby methods.
/// </summary>
public class MethodRb : Method
{
/// <summary>
/// Initializes a new instance of the class MethodTemplateModel.
/// </summary>
public MethodRb()
{
}
/// <summary>
/// Gets the return type name for the underlying interface method
/// </summary>
public virtual string OperationResponseReturnTypeString
{
get
{
return "MsRest::HttpOperationResponse";
}
}
/// <summary>
/// Gets the type for operation exception
/// </summary>
public virtual string OperationExceptionTypeString
{
get
{
return "MsRest::HttpOperationError";
}
}
/// <summary>
/// Gets the code required to initialize response body.
/// </summary>
public virtual string InitializeResponseBody
{
get { return string.Empty; }
}
/// <summary>
/// Gets the list of namespaces where we look for classes that need to
/// be instantiated dynamically due to polymorphism.
/// </summary>
public virtual IEnumerable<string> ClassNamespaces => Enumerable.Empty<string>();
/// <summary>
/// Gets the path parameters as a Ruby dictionary string
/// </summary>
public virtual string PathParamsRbDict
{
get
{
return ParamsToRubyDict(EncodingPathParams);
}
}
/// <summary>
/// Gets the skip encoding path parameters as a Ruby dictionary string
/// </summary>
public virtual string SkipEncodingPathParamsRbDict
{
get
{
return ParamsToRubyDict(SkipEncodingPathParams);
}
}
/// <summary>
/// Gets the query parameters as a Ruby dictionary string
/// </summary>
public virtual string QueryParamsRbDict
{
get
{
return ParamsToRubyDict(EncodingQueryParams);
}
}
/// <summary>
/// Gets the skip encoding query parameters as a Ruby dictionary string
/// </summary>
public virtual string SkipEncodingQueryParamsRbDict
{
get
{
return ParamsToRubyDict(SkipEncodingQueryParams);
}
}
/// <summary>
/// Gets the path parameters not including the params that skip encoding
/// </summary>
public virtual IEnumerable<ParameterRb> EncodingPathParams
{
get
{
return AllPathParams.Where(p => !(p.Extensions.ContainsKey(SwaggerExtensions.SkipUrlEncodingExtension) &&
"true".EqualsIgnoreCase(p.Extensions[SwaggerExtensions.SkipUrlEncodingExtension].ToString())));
}
}
/// <summary>
/// Gets the skip encoding path parameters
/// </summary>
public virtual IEnumerable<ParameterRb> SkipEncodingPathParams
{
get
{
return AllPathParams.Where(p =>
(p.Extensions.ContainsKey(SwaggerExtensions.SkipUrlEncodingExtension) &&
"true".EqualsIgnoreCase(p.Extensions[SwaggerExtensions.SkipUrlEncodingExtension].ToString()) &&
!p.Extensions.ContainsKey("hostParameter")));
}
}
/// <summary>
/// Gets all path parameters
/// </summary>
public virtual IEnumerable<ParameterRb> AllPathParams
{
get { return LogicalParameterTemplateModels.Where(p => p.Location == ParameterLocation.Path); }
}
/// <summary>
/// Gets the skip encoding query parameters
/// </summary>
public virtual IEnumerable<ParameterRb> SkipEncodingQueryParams
{
get { return AllQueryParams.Where(p => p.Extensions.ContainsKey(SwaggerExtensions.SkipUrlEncodingExtension)); }
}
/// <summary>
/// Gets the query parameters not including the params that skip encoding
/// </summary>
public virtual IEnumerable<ParameterRb> EncodingQueryParams
{
get { return AllQueryParams.Where(p => !p.Extensions.ContainsKey(SwaggerExtensions.SkipUrlEncodingExtension)); }
}
/// <summary>
/// Gets all of the query parameters
/// </summary>
public virtual IEnumerable<ParameterRb> AllQueryParams
{
get
{
return LogicalParameterTemplateModels.Where(p => p.Location == ParameterLocation.Query);
}
}
/// <summary>
/// Gets the list of middelwares required for HTTP requests.
/// </summary>
public virtual IList<string> FaradayMiddlewares
{
get
{
return new List<string>()
{
"[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02]",
"[:cookie_jar]"
};
}
}
/// <summary>
/// Gets the expression for default header setting.
/// </summary>
public virtual string SetDefaultHeaders
{
get
{
return string.Empty;
}
}
/// <summary>
/// Gets the list of method paramater templates.
/// </summary>
public IEnumerable<ParameterRb> ParameterTemplateModels => Parameters.Cast<ParameterRb>();
/// <summary>
/// Gets the list of logical method paramater templates.
/// </summary>
private IEnumerable<ParameterRb> LogicalParameterTemplateModels => LogicalParameters.Cast<ParameterRb>();
/// <summary>
/// Gets the list of parameter which need to be included into HTTP header.
/// </summary>
public IEnumerable<Parameter> Headers
{
get
{
return Parameters.Where(p => p.Location == ParameterLocation.Header);
}
}
/// <summary>
/// Gets the URL without query parameters.
/// </summary>
public string UrlWithoutParameters
{
get
{
return ((string)Url).Split('?').First();
}
}
/// <summary>
/// Get the predicate to determine of the http operation status code indicates success
/// </summary>
public string SuccessStatusCodePredicate
{
get
{
if (Responses.Any())
{
List<string> predicates = new List<string>();
foreach (var responseStatus in Responses.Keys)
{
predicates.Add(string.Format("status_code == {0}", GetStatusCodeReference(responseStatus)));
}
return string.Join(" || ", predicates);
}
return "status_code >= 200 && status_code < 300";
}
}
/// <summary>
/// Gets the method parameter declaration parameters list.
/// </summary>
public string MethodParameterDeclaration
{
get
{
List<string> declarations = new List<string>();
foreach (var parameter in MethodParameters.Where(p => !p.IsConstant))
{
string format = "{0}";
if (!parameter.IsRequired)
{
format = "{0} = nil";
if (!parameter.DefaultValue.IsNullOrEmpty()&& parameter.ModelType is PrimaryType)
{
PrimaryType type = parameter.ModelType as PrimaryType;
if (type != null)
{
if (type.KnownPrimaryType == KnownPrimaryType.Boolean || type.KnownPrimaryType == KnownPrimaryType.Double ||
type.KnownPrimaryType == KnownPrimaryType.Int || type.KnownPrimaryType == KnownPrimaryType.Long || type.KnownPrimaryType == KnownPrimaryType.String)
{
format = "{0} = " + parameter.DefaultValue;
}
}
}
}
declarations.Add(string.Format(format, parameter.Name));
}
declarations.Add("custom_headers = nil");
return string.Join(", ", declarations);
}
}
/// <summary>
/// Gets the method parameter invocation parameters list.
/// </summary>
public string MethodParameterInvocation
{
get
{
var invocationParams = MethodParameters.Where(p => !p.IsConstant).Select(p => p.Name).ToList();
invocationParams.Add("custom_headers");
return string.Join(", ", invocationParams);
}
}
/// <summary>
/// Get the parameters that are actually method parameters in the order they appear in the method signature
/// exclude global parameters
/// </summary>
public IEnumerable<ParameterRb> MethodParameters
{
get
{
//Omit parameter group parameters for now since AutoRest-Ruby doesn't support them
return
ParameterTemplateModels.Where(p => p != null && !p.IsClientProperty && !string.IsNullOrWhiteSpace(p.Name) &&!p.IsConstant)
.OrderBy(item => !item.IsRequired);
}
}
/// <summary>
/// Get the method's request body (or null if there is no request body)
/// </summary>
public ParameterRb RequestBody
{
get { return LogicalParameterTemplateModels.FirstOrDefault(p => p.Location == ParameterLocation.Body); }
}
/// <summary>
/// Generate a reference to the ServiceClient
/// </summary>
public string UrlReference
{
get { return true == MethodGroup?.IsCodeModelMethodGroup? "@base_url" : "@client.base_url"; }
}
/// <summary>
/// Generate a reference to the ServiceClient
/// </summary>
public string ClientReference
{
get { return true == MethodGroup?.IsCodeModelMethodGroup ? "self" : "@client"; }
}
/// <summary>
/// Gets the flag indicating whether URL contains path parameters.
/// </summary>
public bool UrlWithPath
{
get
{
return ParameterTemplateModels.Any(p => p.Location == ParameterLocation.Path);
}
}
/// <summary>
/// Gets the type for operation result.
/// </summary>
public virtual string OperationReturnTypeString
{
get
{
return ReturnType.Body.Name.ToString();
}
}
/// <summary>
/// Creates a code in form of string which deserializes given input variable of given type.
/// </summary>
/// <param name="inputVariable">The input variable.</param>
/// <param name="type">The type of input variable.</param>
/// <param name="outputVariable">The output variable.</param>
/// <returns>The deserialization string.</returns>
public virtual string CreateDeserializationString(string inputVariable, IModelType type, string outputVariable)
{
var builder = new IndentedStringBuilder(" ");
var tempVariable = "parsed_response";
// Firstly parsing the input json file into temporay variable.
builder.AppendLine("{0} = {1}.to_s.empty? ? nil : JSON.load({1})", tempVariable, inputVariable);
// Secondly parse each js object into appropriate Ruby type (DateTime, Byte array, etc.)
// and overwrite temporary variable value.
string deserializationLogic = GetDeserializationString(type, outputVariable, tempVariable);
builder.AppendLine(deserializationLogic);
// Assigning value of temporary variable to the output variable.
return builder.ToString();
}
/// <summary>
/// Saves url items from the URL into collection.
/// </summary>
/// <param name="hashName">The name of the collection save url items to.</param>
/// <param name="variableName">The URL variable.</param>
/// <returns>Generated code of saving url items.</returns>
public virtual string SaveExistingUrlItems(string hashName, string variableName)
{
var builder = new IndentedStringBuilder(" ");
// Saving existing URL properties into properties hash.
builder
.AppendLine("unless {0}.query.nil?", variableName)
.Indent()
.AppendLine("{0}.query.split('&').each do |url_item|", variableName)
.Indent()
.AppendLine("url_items_parts = url_item.split('=')")
.AppendLine("{0}[url_items_parts[0]] = url_items_parts[1]", hashName)
.Outdent()
.AppendLine("end")
.Outdent()
.AppendLine("end");
return builder.ToString();
}
/// <summary>
/// Ensures that there is no duplicate forward slashes in the url.
/// </summary>
/// <param name="urlVariableName">The url variable.</param>
/// <returns>Updated url.</returns>
public virtual string RemoveDuplicateForwardSlashes(string urlVariableName)
{
var builder = new IndentedStringBuilder(" ");
// Removing duplicate forward slashes.
builder.AppendLine(@"corrected_url = {0}.to_s.gsub(/([^:])\/\//, '\1/')", urlVariableName);
builder.AppendLine(@"{0} = URI.parse(corrected_url)", urlVariableName);
return builder.ToString();
}
/// <summary>
/// Generate code to build the URL from a url expression and method parameters
/// </summary>
/// <param name="variableName">The variable to store the url in.</param>
/// <returns></returns>
public virtual string BuildUrl(string variableName)
{
var builder = new IndentedStringBuilder(" ");
BuildPathParameters(variableName, builder);
return builder.ToString();
}
/// <summary>
/// Build parameter mapping from parameter grouping transformation.
/// </summary>
/// <returns></returns>
public virtual string BuildInputParameterMappings()
{
var builder = new IndentedStringBuilder(" ");
if (InputParameterTransformation.Count > 0)
{
builder.Indent();
foreach (var transformation in InputParameterTransformation)
{
if (transformation.OutputParameter.ModelType is CompositeType &&
transformation.OutputParameter.IsRequired)
{
builder.AppendLine("{0} = {1}.new",
transformation.OutputParameter.Name,
transformation.OutputParameter.ModelType.Name);
}
else
{
builder.AppendLine("{0} = nil", transformation.OutputParameter.Name);
}
}
foreach (var transformation in InputParameterTransformation)
{
builder.AppendLine("unless {0}", BuildNullCheckExpression(transformation))
.AppendLine().Indent();
var outputParameter = transformation.OutputParameter;
if (transformation.ParameterMappings.Any(m => !string.IsNullOrEmpty(m.OutputParameterProperty)) &&
transformation.OutputParameter.ModelType is CompositeType)
{
//required outputParameter is initialized at the time of declaration
if (!transformation.OutputParameter.IsRequired)
{
builder.AppendLine("{0} = {1}.new",
transformation.OutputParameter.Name,
transformation.OutputParameter.ModelType.Name);
}
}
foreach (var mapping in transformation.ParameterMappings)
{
builder.AppendLine(mapping.CreateCode(transformation.OutputParameter));
}
builder.Outdent().AppendLine("end");
}
}
return builder.ToString();
}
/// <summary>
/// Generates response or body of method
/// </summary>
public virtual string ResponseGeneration()
{
IndentedStringBuilder builder = new IndentedStringBuilder("");
builder.AppendLine("response = {0}_async({1}).value!", Name, MethodParameterInvocation);
if (ReturnType.Body != null)
{
builder.AppendLine("response.body unless response.nil?");
}
else
{
builder.AppendLine("nil");
}
return builder.ToString();
}
/// <summary>
/// Gets the formatted status code.
/// </summary>
/// <param name="code">The status code.</param>
/// <returns>Formatted status code.</returns>
public string GetStatusCodeReference(HttpStatusCode code)
{
return string.Format("{0}", (int)code);
}
/// <summary>
/// Generate code to replace path parameters in the url template with the appropriate values
/// </summary>
/// <param name="variableName">The variable name for the url to be constructed</param>
/// <param name="builder">The string builder for url construction</param>
protected virtual void BuildPathParameters(string variableName, IndentedStringBuilder builder)
{
if (builder == null)
{
throw new ArgumentNullException("builder");
}
IEnumerable<Parameter> pathParameters = LogicalParameters.Where(p => p.Extensions.ContainsKey("hostParameter") && p.Location == ParameterLocation.Path);
foreach (var pathParameter in pathParameters)
{
var pathReplaceFormat = "{0} = {0}.gsub('{{{1}}}', {2})";
builder.AppendLine(pathReplaceFormat, variableName, pathParameter.SerializedName, pathParameter.GetFormattedReferenceValue());
}
}
/// <summary>
/// Builds the parameters as a Ruby dictionary string
/// </summary>
/// <param name="parameters">The enumerable of parameters to be turned into a Ruby dictionary.</param>
/// <returns>ruby dictionary as a string</returns>
protected string ParamsToRubyDict(IEnumerable<ParameterRb> parameters)
{
var encodedParameters = new List<string>();
foreach (var param in parameters)
{
string variableName = param.Name;
encodedParameters.Add(string.Format("'{0}' => {1}", param.SerializedName, param.GetFormattedReferenceValue()));
}
return string.Format(CultureInfo.InvariantCulture, "{{{0}}}", string.Join(",", encodedParameters));
}
/// <summary>
/// Constructs mapper for the request body.
/// </summary>
/// <param name="outputVariable">Name of the output variable.</param>
/// <returns>Mapper for the request body as string.</returns>
public string ConstructRequestBodyMapper(string outputVariable = "request_mapper")
{
var builder = new IndentedStringBuilder(" ");
if (RequestBody.ModelType is CompositeType)
{
builder.AppendLine("{0} = {1}.mapper()", outputVariable, RequestBody.ModelType.Name);
}
else
{
builder.AppendLine("{0} = {{{1}}}", outputVariable,
RequestBody.ModelType.ConstructMapper(RequestBody.SerializedName, RequestBody, false));
}
return builder.ToString();
}
/// <summary>
/// Creates deserialization logic for the given <paramref name="type"/>.
/// </summary>
/// <param name="type">Type for which deserialization logic being constructed.</param>
/// <param name="valueReference">Reference variable name.</param>
/// <param name="responseVariable">Response variable name.</param>
/// <returns>Deserialization logic for the given <paramref name="type"/> as string.</returns>
/// <exception cref="ArgumentNullException">Thrown when a required parameter is null.</exception>
public string GetDeserializationString(IModelType type, string valueReference = "result", string responseVariable = "parsed_response")
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
var builder = new IndentedStringBuilder(" ");
if (type is CompositeType)
{
builder.AppendLine("result_mapper = {0}.mapper()", type.Name);
}
else
{
builder.AppendLine("result_mapper = {{{0}}}", type.ConstructMapper(responseVariable, null, false));
}
if (MethodGroup.IsCodeModelMethodGroup)
{
builder.AppendLine("{1} = self.deserialize(result_mapper, {0}, '{1}')", responseVariable, valueReference);
}
else
{
builder.AppendLine("{1} = @client.deserialize(result_mapper, {0}, '{1}')", responseVariable, valueReference);
}
return builder.ToString();
}
/// <summary>
/// Builds null check expression for the given <paramref name="transformation"/>.
/// </summary>
/// <param name="transformation">ParameterTransformation for which to build null check expression.</param>
/// <returns></returns>
private static string BuildNullCheckExpression(ParameterTransformation transformation)
{
if (transformation == null)
{
throw new ArgumentNullException("transformation");
}
if (transformation.ParameterMappings.Count == 1)
{
return string.Format(CultureInfo.InvariantCulture,
"{0}.nil?", transformation.ParameterMappings[0].InputParameter.Name);
}
else
{
return string.Join(" && ",
transformation.ParameterMappings.Select(m =>
string.Format(CultureInfo.InvariantCulture,
"{0}.nil?", m.InputParameter.Name)));
}
}
}
} | 37.954474 | 184 | 0.542499 | [
"MIT"
] | DiogenesPolanco/autorest | src/generator/AutoRest.Ruby/Model/MethodRb.cs | 24,179 | C# |
using System.Collections.Generic;
namespace Bio.Algorithms.Alignment
{
/// <summary>
/// An ISequenceAlignment is the result of running an alignment algorithm on a set
/// of two or more sequences. This could be a pairwise alignment, an MSA (multiple
/// sequence alignment), or an overlap alignment of the sort needed for sequence
/// assembly.
/// </summary>
/// <remarks>
/// this is just a storage object – it’s up to an algorithm object to fill it in.
/// for efficiency’s sake, we are leaving it up to calling code to keep track of the
/// input sequences, if desired.
/// </remarks>
public interface ISequenceAlignment
{
/// <summary>
/// Gets list of the IAlignedSequences which contains aligned sequences with score, offset and consensus .
/// </summary>
IList<IAlignedSequence> AlignedSequences { get; }
/// <summary>
/// Gets list of sequences.
/// </summary>
IList<ISequence> Sequences { get; }
/// <summary>
/// Gets any additional information about the Alignment.
/// </summary>
Dictionary<string, object> Metadata { get; }
/// <summary>
/// Gets or sets Documentation object is intended for tracking the history, provenance,
/// and experimental context of a sequence. The user can adopt any desired
/// convention for use of this object.
/// </summary>
object Documentation { get; set; }
}
}
| 36.97561 | 114 | 0.626649 | [
"Apache-2.0"
] | jdm7dv/Microsoft-Biology-Foundation | Source/Framework/Bio/Algorithms/Alignment/ISequenceAlignment.cs | 1,524 | C# |
namespace Toolset.Networking
{
/// <summary>
/// A class of settings that can be passed into a NetworkRequest to modify its behavior.
/// </summary>
public class NetworkRequestSettings
{
/// <summary>
/// An enum value representing how this request should behave in the case of a
/// timeout or a retryable error.
/// </summary>
public RequestRetryPolicy RetryPolicy { get; set; } = RequestRetryPolicy.Silent;
/// <summary>
/// The maximum number of attempts allowed for this request.
/// </summary>
public int MaximumAttemptCount { get; set; } = 5;
/// <summary>
/// The initial time, in milliseconds, of the fibonacci backoff sequence
/// for Silent request retries.
/// </summary>
public int SilentRetryInitialWaitMilliseconds { get; set; } = 1000;
}
}
| 35.423077 | 93 | 0.596091 | [
"Apache-2.0"
] | Karazaa/Toolset | Assets/Toolset/Networking/Scripts/BaseNetworkRequest/NetworkRequestSettings.cs | 921 | C# |
namespace Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview
{
using static Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Runtime.Extensions;
/// <summary>Storage setting</summary>
public partial class StorageSetting :
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.IStorageSetting,
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Models.Api20210201Preview.IStorageSettingInternal
{
/// <summary>Backing field for <see cref="DatastoreType" /> property.</summary>
private Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingStoreTypes? _datastoreType;
/// <summary>Gets or sets the type of the datastore.</summary>
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataProtection.PropertyOrigin.Owned)]
public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingStoreTypes? DatastoreType { get => this._datastoreType; set => this._datastoreType = value; }
/// <summary>Backing field for <see cref="Type" /> property.</summary>
private Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingTypes? _type;
/// <summary>Gets or sets the type.</summary>
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Origin(Microsoft.Azure.PowerShell.Cmdlets.DataProtection.PropertyOrigin.Owned)]
public Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingTypes? Type { get => this._type; set => this._type = value; }
/// <summary>Creates an new <see cref="StorageSetting" /> instance.</summary>
public StorageSetting()
{
}
}
/// Storage setting
public partial interface IStorageSetting :
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Runtime.IJsonSerializable
{
/// <summary>Gets or sets the type of the datastore.</summary>
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Gets or sets the type of the datastore.",
SerializedName = @"datastoreType",
PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingStoreTypes) })]
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingStoreTypes? DatastoreType { get; set; }
/// <summary>Gets or sets the type.</summary>
[Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Gets or sets the type.",
SerializedName = @"type",
PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingTypes) })]
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingTypes? Type { get; set; }
}
/// Storage setting
internal partial interface IStorageSettingInternal
{
/// <summary>Gets or sets the type of the datastore.</summary>
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingStoreTypes? DatastoreType { get; set; }
/// <summary>Gets or sets the type.</summary>
Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.StorageSettingTypes? Type { get; set; }
}
} | 54.968254 | 181 | 0.710367 | [
"MIT"
] | Khushboo-Baheti/azure-powershell | src/DataProtection/generated/api/Models/Api20210201Preview/StorageSetting.cs | 3,401 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Utilities;
namespace Microsoft.EntityFrameworkCore
{
/// <summary>
/// The options to be used by a <see cref="DbContext" />. You normally override
/// <see cref="DbContext.OnConfiguring(DbContextOptionsBuilder)" /> or use a <see cref="DbContextOptionsBuilder" />
/// to create instances of this class and it is not designed to be directly constructed in your application code.
/// </summary>
public abstract class DbContextOptions : IDbContextOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="DbContextOptions" /> class. You normally override
/// <see cref="DbContext.OnConfiguring(DbContextOptionsBuilder)" /> or use a <see cref="DbContextOptionsBuilder" />
/// to create instances of this class and it is not designed to be directly constructed in your application code.
/// </summary>
/// <param name="extensions"> The extensions that store the configured options. </param>
protected DbContextOptions(
[NotNull] IReadOnlyDictionary<Type, IDbContextOptionsExtension> extensions)
{
Check.NotNull(extensions, nameof(extensions));
_extensions = extensions;
}
/// <summary>
/// Gets the extensions that store the configured options.
/// </summary>
public virtual IEnumerable<IDbContextOptionsExtension> Extensions => _extensions.Values;
/// <summary>
/// Gets the extension of the specified type. Returns null if no extension of the specified type is configured.
/// </summary>
/// <typeparam name="TExtension"> The type of the extension to get. </typeparam>
/// <returns> The extension, or null if none was found. </returns>
public virtual TExtension FindExtension<TExtension>()
where TExtension : class, IDbContextOptionsExtension
{
IDbContextOptionsExtension extension;
return _extensions.TryGetValue(typeof(TExtension), out extension) ? (TExtension)extension : null;
}
/// <summary>
/// Gets the extension of the specified type. Throws if no extension of the specified type is configured.
/// </summary>
/// <typeparam name="TExtension"> The type of the extension to get. </typeparam>
/// <returns> The extension. </returns>
public virtual TExtension GetExtension<TExtension>()
where TExtension : class, IDbContextOptionsExtension
{
var extension = FindExtension<TExtension>();
if (extension == null)
{
throw new InvalidOperationException(CoreStrings.OptionsExtensionNotFound(typeof(TExtension).Name));
}
return extension;
}
/// <summary>
/// Adds the given extension to the options.
/// </summary>
/// <typeparam name="TExtension"> The type of extension to be added. </typeparam>
/// <param name="extension"> The extension to be added. </param>
/// <returns> The same options instance so that multiple calls can be chained. </returns>
public abstract DbContextOptions WithExtension<TExtension>([NotNull] TExtension extension)
where TExtension : class, IDbContextOptionsExtension;
private readonly IReadOnlyDictionary<Type, IDbContextOptionsExtension> _extensions;
/// <summary>
/// The type of context that these options are for. Will return <see cref="DbContext"/> if the
/// options are not built for a specific derived context.
/// </summary>
public abstract Type ContextType { get; }
}
}
| 48.152941 | 127 | 0.657953 | [
"Apache-2.0"
] | joshcomley/EntityFramework-archive | src/Microsoft.EntityFrameworkCore/DbContextOptions.cs | 4,093 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Charlotte.Commons;
using Charlotte.GameCommons;
namespace Charlotte.Tests
{
public class Test0001
{
public void Test01()
{
for (; ; )
{
if (DDInput.PAUSE.GetInput() == 1)
{
Ground.I.Music.MUS_TITLE.Play();
}
if (DDInput.A.GetInput() == 1)
{
Ground.I.Music.MUS_STAGE_01.Play();
}
if (DDInput.B.GetInput() == 1)
{
Ground.I.Music.MUS_BOSS_01.Play();
}
if (DDInput.C.GetInput() == 1)
{
Ground.I.Music.MUS_STAGE_02.Play();
}
if (DDInput.D.GetInput() == 1)
{
Ground.I.Music.MUS_BOSS_02.Play();
}
DDCurtain.DrawCurtain();
DDPrint.SetPrint();
DDPrint.Print("音量テスト");
DDEngine.EachFrame();
}
}
}
}
| 17.12766 | 40 | 0.596273 | [
"MIT"
] | soleil-taruto/Elsa | e20201224_Udongedon/Elsa20200001/Elsa20200001/Tests/Test0001.cs | 817 | C# |
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Collections.Generic;
using System.Linq;
namespace Tailwind.Traders.WebBff.Extensions
{
public static class SwaggerExtensions
{
public static IServiceCollection AddSwagger(this IServiceCollection services)
{
return services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "Tailwind Traders - Web BFF HTTP API",
Version = "v1"
});
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.ApiKey,
Name = "Authorization",
Scheme = "Bearer",
In = ParameterLocation.Header,
Description = "JWT Authorization header. Example: \"Bearer {token}\""
});
options.OperationFilter<SecurityRequirementsOperationFilter>();
});
}
}
public class SecurityRequirementsOperationFilter : IOperationFilter
{
public void Apply(OpenApiOperation operation, OperationFilterContext context)
{
// Policy names map to scopes
var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
.Union(context.MethodInfo.GetCustomAttributes(true))
.OfType<AuthorizeAttribute>().Any();
if (hasAuthorize)
{
operation.Responses.Add("401", new OpenApiResponse { Description = "Unauthorized" });
var oAuthScheme = new OpenApiSecurityScheme
{
Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "oauth2" }
};
operation.Security = new List<OpenApiSecurityRequirement>
{
new OpenApiSecurityRequirement { [ oAuthScheme ] = new string[] { } }
};
}
}
}
}
| 36.803279 | 108 | 0.563029 | [
"MIT"
] | 4villains/TailwindTraders-Backend-1 | Source/ApiGWs/Tailwind.Traders.WebBff/Extensions/SwaggerExtensions.cs | 2,247 | C# |
using OpenItems.Properties;
namespace GSA.OpenItems.Web
{
using System;
using System.Configuration;
using Data;
public partial class FundsReport : PageBase
{
private readonly UsersBO Users;
public FundsReport()
{
Users = new UsersBO(this.Dal, new EmailsBO(this.Dal));
}
protected override void PageLoadEvent(object sender, System.EventArgs e)
{
try
{
if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "JS"))
{
Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "JS",
"<script language='javascript' src='include/FundsReport.js'></script>");
//Page.ClientScript.RegisterStartupScript(Page.GetType(), "JS_OnLoad",
// "<script FOR=window EVENT=onload language='javascript'>Page_OnLoad()</script>");
}
if (!IsPostBack)
{
ctrlCriteria.ScreenType = (int)FundsStatusScreenType.stFundStatusReport;
ctrlCriteria.InitControls();
if (Request.QueryString["back"] != null && Request.QueryString["back"] == "y")
{
//back from Funds Review screen - display previous report:
ctrlCriteria.DisplayPrevSelectedValues(FundsStatusSelectedValues);
BuildReport();
}
else if (Request.QueryString["fy"] != null && Request.QueryString["fy"] != "")
{
ctrlCriteria.FiscalYear = Request.QueryString["fy"];
ctrlCriteria.BookMonth = Request.QueryString["bm"];
ctrlCriteria.BusinessLine = Request.QueryString["bl"];
ctrlCriteria.Organization = Request.QueryString["org"];
//ctrlCriteria.AllowReturnBack("SummaryReport.aspx?back=y");
FundsStatusSelectedValues = ctrlCriteria.SaveCurrentSelectedValues();
BuildReport();
}
}
}
catch (Exception ex)
{
AddError(ex);
}
finally
{
//if (Errors.Count > 0)
// lblError.Text = GetErrors();
}
}
protected void Page_Init(object sender, EventArgs e)
{
ctrlCriteria.Submit += new EventHandler(ctrlCriteria_Submit);
}
void ctrlCriteria_Submit(object sender, EventArgs e)
{
try
{
FundsStatusSelectedValues = ctrlCriteria.SaveCurrentSelectedValues();
BuildReport();
}
catch (Exception ex)
{
AddError(ex);
}
finally
{
//if (Errors.Count > 0)
// lblError.Text = GetErrors();
}
}
private void BuildReport()
{
lblState.Text = "";
if (!(User.IsInRole(((int)UserRoles.urFSBDPowerReader).ToString()) || User.IsInRole(((int)UserRoles.urFSBDAnalystFundsCoordinator).ToString()) ||
User.IsInRole(((int)UserRoles.urFSBDAdminAllowanceRO).ToString()) || User.IsInRole(((int)UserRoles.urFSBDAdminAllowanceWR).ToString())))
{
if (Users.UserAuthorizedForFSReports(CurrentUserID, ctrlCriteria.BusinessLine, ctrlCriteria.Organization) <= 0)
throw new Exception("You are not authorized to see current report. Please select Business Line or Organization that you are allowed to review. Thank you.");
}
//first check if the report data is valid:
var status = FSSummaryReport.GetReportStateStatus(ctrlCriteria.FiscalYear, ctrlCriteria.Organization, ctrlCriteria.BusinessLine);
if (status == (int)FundStatusReportStateStatus.rsDoesNotExist)
{
divReportState.Visible = true;
lblState.Text = String.Format("Fund Status Report for Organization {0}, Fiscal Year {1} is not available at this moment. <p />The report data is updated by automated process every {2} minutes. <br />You can request the report immediately (it might take a few minutes). Thank you.", ctrlCriteria.Organization, ctrlCriteria.FiscalYear, Settings.Default.RebuildReportIntervalInMinutes);
}
else if (status == (int)FundStatusReportStateStatus.rsObsolete)
{
divReportState.Visible = true;
lblState.Text = String.Format("Fund Status Report for Organization {0}, Fiscal Year {1} is obsolete. <p />The report data is updated by automated process every {2} minutes. <br />You can request the report immediately (it might take a few minutes). Thank you.", ctrlCriteria.Organization, ctrlCriteria.FiscalYear, Settings.Default.RebuildReportIntervalInMinutes);
}
else
{
divReportState.Visible = false;
lblState.Text = "";
}
if (status == (int)FundStatusReportStateStatus.rsObsolete || status == (int)FundStatusReportStateStatus.rsValid)
{
//draw the table tblData:
var drawing_class = new FSReportUI();
drawing_class.FiscalYear = ctrlCriteria.FiscalYear;
drawing_class.BookMonth = ctrlCriteria.BookMonth;
drawing_class.Organization = ctrlCriteria.Organization;
drawing_class.BusinessLine = ctrlCriteria.BusinessLine;
drawing_class.TableToDraw = tblData;
drawing_class.BuildHTMLTable();
tblData = drawing_class.TableToDraw;
}
}
}
} | 44.296296 | 399 | 0.560201 | [
"CC0-1.0"
] | gaybro8777/FM-ULO | Archive/OpenItems/FundStatus/FundsReport.aspx.cs | 5,980 | C# |
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Pipedrive.CustomFields
{
public class PersonCustomField : ICustomField
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("email")]
public List<Email> Email { get; set; }
[JsonProperty("phone")]
public List<Phone> Phone { get; set; }
[JsonProperty("value")]
public long Value { get; set; }
}
}
| 22.047619 | 49 | 0.604752 | [
"MIT"
] | adrianotrentim/pipedrive-dotnet | src/Pipedrive.net/Models/Common/CustomFields/PersonCustomField.cs | 465 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using GLTF;
using GLTF.Schema;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityGLTF.Cache;
using UnityGLTF.Extensions;
namespace UnityGLTF
{
public class GLTFSceneImporter
{
public enum MaterialType
{
PbrMetallicRoughness,
KHR_materials_pbrSpecularGlossiness,
CommonConstant,
CommonPhong,
CommonBlinn,
CommonLambert
}
private enum LoadType
{
Uri,
Stream
}
protected GameObject _lastLoadedScene;
protected readonly Transform _sceneParent;
protected readonly Dictionary<MaterialType, Shader> _shaderCache = new Dictionary<MaterialType, Shader>();
public int MaximumLod = 300;
protected readonly GLTF.Schema.Material DefaultMaterial = new GLTF.Schema.Material();
protected string _gltfUrl;
protected string _gltfDirectoryPath;
protected Stream _gltfStream;
protected GLTFRoot _root;
protected AssetCache _assetCache;
protected AsyncAction _asyncAction;
protected bool _addColliders = false;
byte[] _gltfData;
LoadType _loadType;
/// <summary>
/// Creates a GLTFSceneBuilder object which will be able to construct a scene based off a url
/// </summary>
/// <param name="gltfUrl">URL to load</param>
/// <param name="parent"></param>
/// <param name="addColliders">Option to add mesh colliders to primitives</param>
public GLTFSceneImporter(string gltfUrl, Transform parent = null, bool addColliders = false)
{
_gltfUrl = gltfUrl;
_gltfDirectoryPath = AbsoluteUriPath(gltfUrl);
_sceneParent = parent;
_asyncAction = new AsyncAction();
_loadType = LoadType.Uri;
_addColliders = addColliders;
}
public GLTFSceneImporter(string rootPath, Stream stream, Transform parent = null, bool addColliders = false)
{
_gltfUrl = rootPath;
_gltfDirectoryPath = AbsoluteFilePath(rootPath);
_gltfStream = stream;
_sceneParent = parent;
_asyncAction = new AsyncAction();
_loadType = LoadType.Stream;
_addColliders = addColliders;
}
public GameObject LastLoadedScene
{
get { return _lastLoadedScene; }
}
/// <summary>
/// Configures shaders in the shader cache for a given material type
/// </summary>
/// <param name="type">Material type to setup shader for</param>
/// <param name="shader">Shader object to apply</param>
public virtual void SetShaderForMaterialType(MaterialType type, Shader shader)
{
_shaderCache.Add(type, shader);
}
/// <summary>
/// Loads via a web call the gltf file and then constructs a scene
/// </summary>
/// <param name="sceneIndex">Index into scene to load. -1 means load default</param>
/// <param name="isMultithreaded">Whether to do loading operation on a thread</param>
/// <returns></returns>
public IEnumerator Load(int sceneIndex = -1, bool isMultithreaded = false)
{
if (_loadType == LoadType.Uri)
{
var www = UnityWebRequest.Get(_gltfUrl);
#if UNITY_2017_2_OR_NEWER
yield return www.SendWebRequest();
#else
yield return www.Send();
#endif
if (www.responseCode >= 400 || www.responseCode == 0)
{
throw new WebRequestException(www);
}
_gltfData = www.downloadHandler.data;
}
else if (_loadType == LoadType.Stream)
{
// todo optimization: add stream support to parsing layer
int streamLength = (int)(_gltfStream.Length - _gltfStream.Position);
_gltfData = new byte[streamLength];
_gltfStream.Read(_gltfData, 0, streamLength);
}
else
{
throw new Exception("Invalid load type specified: " + _loadType);
}
_root = GLTFParser.ParseJson(_gltfData);
yield return ImportScene(sceneIndex, isMultithreaded);
}
/// <summary>
/// Creates a scene based off loaded JSON. Includes loading in binary and image data to construct the meshes required.
/// </summary>
/// <param name="sceneIndex">The index of scene in gltf file to load</param>
/// <param name="isMultithreaded">Whether to use a thread to do loading</param>
/// <returns></returns>
protected IEnumerator ImportScene(int sceneIndex = -1, bool isMultithreaded = false)
{
Scene scene;
if (sceneIndex >= 0 && sceneIndex < _root.Scenes.Count)
{
scene = _root.Scenes[sceneIndex];
}
else
{
scene = _root.GetDefaultScene();
}
if (scene == null)
{
throw new Exception("No default scene in gltf file.");
}
_assetCache = new AssetCache(
_root.Images != null ? _root.Images.Count : 0,
_root.Textures != null ? _root.Textures.Count : 0,
_root.Materials != null ? _root.Materials.Count : 0,
_root.Buffers != null ? _root.Buffers.Count : 0,
_root.Meshes != null ? _root.Meshes.Count : 0
);
if (_lastLoadedScene == null)
{
if (_root.Buffers != null)
{
// todo add fuzzing to verify that buffers are before uri
for (int i = 0; i < _root.Buffers.Count; ++i)
{
GLTF.Schema.Buffer buffer = _root.Buffers[i];
if (buffer.Uri != null)
{
yield return LoadBuffer(_gltfDirectoryPath, buffer, i);
}
else //null buffer uri indicates GLB buffer loading
{
byte[] glbBuffer;
GLTFParser.ExtractBinaryChunk(_gltfData, i, out glbBuffer);
_assetCache.BufferCache[i] = glbBuffer;
}
}
}
if (_root.Images != null)
{
for (int i = 0; i < _root.Images.Count; ++i)
{
Image image = _root.Images[i];
yield return LoadImage(_gltfDirectoryPath, image, i);
}
}
// generate these in advance instead of as-needed
if (isMultithreaded)
{
yield return _asyncAction.RunOnWorkerThread(() => BuildAttributesForMeshes());
}
}
var sceneObj = CreateScene(scene);
if (_sceneParent != null)
{
sceneObj.transform.SetParent(_sceneParent, false);
}
_lastLoadedScene = sceneObj;
}
protected virtual void BuildAttributesForMeshes()
{
for (int i = 0; i < _root.Meshes.Count; ++i)
{
GLTF.Schema.Mesh mesh = _root.Meshes[i];
if (_assetCache.MeshCache[i] == null)
{
_assetCache.MeshCache[i] = new MeshCacheData[mesh.Primitives.Count];
}
for (int j = 0; j < mesh.Primitives.Count; ++j)
{
_assetCache.MeshCache[i][j] = new MeshCacheData();
var primitive = mesh.Primitives[j];
BuildMeshAttributes(primitive, i, j);
}
}
}
protected virtual void BuildMeshAttributes(MeshPrimitive primitive, int meshID, int primitiveIndex)
{
if (_assetCache.MeshCache[meshID][primitiveIndex].MeshAttributes.Count == 0)
{
Dictionary<string, AttributeAccessor> attributeAccessors = new Dictionary<string, AttributeAccessor>(primitive.Attributes.Count + 1);
foreach (var attributePair in primitive.Attributes)
{
AttributeAccessor AttributeAccessor = new AttributeAccessor()
{
AccessorId = attributePair.Value,
Buffer = _assetCache.BufferCache[attributePair.Value.Value.BufferView.Value.Buffer.Id]
};
attributeAccessors[attributePair.Key] = AttributeAccessor;
}
if (primitive.Indices != null)
{
AttributeAccessor indexBuilder = new AttributeAccessor()
{
AccessorId = primitive.Indices,
Buffer = _assetCache.BufferCache[primitive.Indices.Value.BufferView.Value.Buffer.Id]
};
attributeAccessors[SemanticProperties.INDICES] = indexBuilder;
}
GLTFHelpers.BuildMeshAttributes(ref attributeAccessors);
// Flip vectors and triangles to the Unity coordinate system.
if (attributeAccessors.ContainsKey(SemanticProperties.POSITION))
{
NumericArray resultArray = attributeAccessors[SemanticProperties.POSITION].AccessorContent;
resultArray.AsVertices = GLTFUnityHelpers.FlipVectorArrayHandedness(resultArray.AsVertices);
attributeAccessors[SemanticProperties.POSITION].AccessorContent = resultArray;
}
if (attributeAccessors.ContainsKey(SemanticProperties.INDICES))
{
NumericArray resultArray = attributeAccessors[SemanticProperties.INDICES].AccessorContent;
resultArray.AsTriangles = GLTFUnityHelpers.FlipFaces(resultArray.AsTriangles);
attributeAccessors[SemanticProperties.INDICES].AccessorContent = resultArray;
}
if (attributeAccessors.ContainsKey(SemanticProperties.NORMAL))
{
NumericArray resultArray = attributeAccessors[SemanticProperties.NORMAL].AccessorContent;
resultArray.AsNormals = GLTFUnityHelpers.FlipVectorArrayHandedness(resultArray.AsNormals);
attributeAccessors[SemanticProperties.NORMAL].AccessorContent = resultArray;
}
// TexCoord goes from 0 to 3 to match GLTFHelpers.BuildMeshAttributes
for (int i = 0; i < 4; i++)
{
if (attributeAccessors.ContainsKey(SemanticProperties.TexCoord(i)))
{
NumericArray resultArray = attributeAccessors[SemanticProperties.TexCoord(i)].AccessorContent;
resultArray.AsTexcoords = GLTFUnityHelpers.FlipTexCoordArrayV(resultArray.AsTexcoords);
attributeAccessors[SemanticProperties.TexCoord(i)].AccessorContent = resultArray;
}
}
if (attributeAccessors.ContainsKey(SemanticProperties.TANGENT))
{
NumericArray resultArray = attributeAccessors[SemanticProperties.TANGENT].AccessorContent;
resultArray.AsTangents = GLTFUnityHelpers.FlipVectorArrayHandedness(resultArray.AsTangents);
attributeAccessors[SemanticProperties.TANGENT].AccessorContent = resultArray;
}
_assetCache.MeshCache[meshID][primitiveIndex].MeshAttributes = attributeAccessors;
}
}
protected virtual GameObject CreateScene(Scene scene)
{
var sceneObj = new GameObject(scene.Name ?? "GLTFScene");
foreach (var node in scene.Nodes)
{
var nodeObj = CreateNode(node.Value);
nodeObj.transform.SetParent(sceneObj.transform, false);
}
return sceneObj;
}
protected virtual GameObject CreateNode(Node node)
{
var nodeObj = new GameObject(node.Name ?? "GLTFNode");
Vector3 position;
Quaternion rotation;
Vector3 scale;
node.GetUnityTRSProperties(out position, out rotation, out scale);
nodeObj.transform.localPosition = position;
nodeObj.transform.localRotation = rotation;
nodeObj.transform.localScale = scale;
// TODO: Add support for skin/morph targets
if (node.Mesh != null)
{
CreateMeshObject(node.Mesh.Value, nodeObj.transform, node.Mesh.Id);
}
/* TODO: implement camera (probably a flag to disable for VR as well)
if (camera != null)
{
GameObject cameraObj = camera.Value.Create();
cameraObj.transform.parent = nodeObj.transform;
}
*/
if (node.Children != null)
{
foreach (var child in node.Children)
{
var childObj = CreateNode(child.Value);
childObj.transform.SetParent(nodeObj.transform, false);
}
}
return nodeObj;
}
protected virtual void CreateMeshObject(GLTF.Schema.Mesh mesh, Transform parent, int meshId)
{
if (_assetCache.MeshCache[meshId] == null)
{
_assetCache.MeshCache[meshId] = new MeshCacheData[mesh.Primitives.Count];
}
for (int i = 0; i < mesh.Primitives.Count; ++i)
{
var primitive = mesh.Primitives[i];
var primitiveObj = CreateMeshPrimitive(primitive, meshId, i);
primitiveObj.transform.SetParent(parent, false);
primitiveObj.SetActive(true);
}
}
protected virtual GameObject CreateMeshPrimitive(MeshPrimitive primitive, int meshID, int primitiveIndex)
{
var primitiveObj = new GameObject("Primitive");
var meshFilter = primitiveObj.AddComponent<MeshFilter>();
if (_assetCache.MeshCache[meshID][primitiveIndex] == null)
{
_assetCache.MeshCache[meshID][primitiveIndex] = new MeshCacheData();
}
if (_assetCache.MeshCache[meshID][primitiveIndex].LoadedMesh == null)
{
if (_assetCache.MeshCache[meshID][primitiveIndex].MeshAttributes.Count == 0)
{
BuildMeshAttributes(primitive, meshID, primitiveIndex);
}
var meshAttributes = _assetCache.MeshCache[meshID][primitiveIndex].MeshAttributes;
var vertexCount = primitive.Attributes[SemanticProperties.POSITION].Value.Count;
// todo optimize: There are multiple copies being performed to turn the buffer data into mesh data. Look into reducing them
UnityEngine.Mesh mesh = new UnityEngine.Mesh
{
vertices = primitive.Attributes.ContainsKey(SemanticProperties.POSITION)
? meshAttributes[SemanticProperties.POSITION].AccessorContent.AsVertices.ToUnityVector3()
: null,
normals = primitive.Attributes.ContainsKey(SemanticProperties.NORMAL)
? meshAttributes[SemanticProperties.NORMAL].AccessorContent.AsNormals.ToUnityVector3()
: null,
uv = primitive.Attributes.ContainsKey(SemanticProperties.TexCoord(0))
? meshAttributes[SemanticProperties.TexCoord(0)].AccessorContent.AsTexcoords.ToUnityVector2()
: null,
uv2 = primitive.Attributes.ContainsKey(SemanticProperties.TexCoord(1))
? meshAttributes[SemanticProperties.TexCoord(1)].AccessorContent.AsTexcoords.ToUnityVector2()
: null,
uv3 = primitive.Attributes.ContainsKey(SemanticProperties.TexCoord(2))
? meshAttributes[SemanticProperties.TexCoord(2)].AccessorContent.AsTexcoords.ToUnityVector2()
: null,
uv4 = primitive.Attributes.ContainsKey(SemanticProperties.TexCoord(3))
? meshAttributes[SemanticProperties.TexCoord(3)].AccessorContent.AsTexcoords.ToUnityVector2()
: null,
colors = primitive.Attributes.ContainsKey(SemanticProperties.Color(0))
? meshAttributes[SemanticProperties.Color(0)].AccessorContent.AsColors.ToUnityColor()
: null,
triangles = primitive.Indices != null
? meshAttributes[SemanticProperties.INDICES].AccessorContent.AsTriangles
: MeshPrimitive.GenerateTriangles(vertexCount),
tangents = primitive.Attributes.ContainsKey(SemanticProperties.TANGENT)
? meshAttributes[SemanticProperties.TANGENT].AccessorContent.AsTangents.ToUnityVector4()
: null
};
_assetCache.MeshCache[meshID][primitiveIndex].LoadedMesh = mesh;
}
meshFilter.sharedMesh = _assetCache.MeshCache[meshID][primitiveIndex].LoadedMesh;
var materialWrapper = CreateMaterial(
primitive.Material != null ? primitive.Material.Value : DefaultMaterial,
primitive.Material != null ? primitive.Material.Id : -1
);
var meshRenderer = primitiveObj.AddComponent<MeshRenderer>();
meshRenderer.material = materialWrapper.GetContents(primitive.Attributes.ContainsKey(SemanticProperties.Color(0)));
if (_addColliders)
{
var meshCollider = primitiveObj.AddComponent<MeshCollider>();
meshCollider.sharedMesh = meshFilter.mesh;
}
return primitiveObj;
}
protected virtual MaterialCacheData CreateMaterial(GLTF.Schema.Material def, int materialIndex)
{
MaterialCacheData materialWrapper = null;
if (materialIndex < 0 || _assetCache.MaterialCache[materialIndex] == null)
{
Shader shader;
// get the shader to use for this material
try
{
if (_root.ExtensionsUsed != null && _root.ExtensionsUsed.Contains("KHR_materials_pbrSpecularGlossiness"))
shader = _shaderCache[MaterialType.KHR_materials_pbrSpecularGlossiness];
else if (def.PbrMetallicRoughness != null)
shader = _shaderCache[MaterialType.PbrMetallicRoughness];
else if (_root.ExtensionsUsed != null && _root.ExtensionsUsed.Contains("KHR_materials_common")
&& def.CommonConstant != null)
shader = _shaderCache[MaterialType.CommonConstant];
else
shader = _shaderCache[MaterialType.PbrMetallicRoughness];
}
catch (KeyNotFoundException)
{
Debug.LogWarningFormat("No shader supplied for type of glTF material {0}, using Standard fallback", def.Name);
shader = Shader.Find("Standard");
}
shader.maximumLOD = MaximumLod;
var material = new UnityEngine.Material(shader);
if (def.AlphaMode == AlphaMode.MASK)
{
material.SetOverrideTag("RenderType", "TransparentCutout");
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
material.SetInt("_ZWrite", 1);
material.EnableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
material.SetFloat("_Cutoff", (float)def.AlphaCutoff);
}
else if (def.AlphaMode == AlphaMode.BLEND)
{
material.SetOverrideTag("RenderType", "Transparent");
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
material.SetInt("_ZWrite", 0);
material.DisableKeyword("_ALPHATEST_ON");
material.EnableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
}
else
{
material.SetOverrideTag("RenderType", "Opaque");
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
material.SetInt("_ZWrite", 1);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = -1;
}
if (def.DoubleSided)
{
material.SetInt("_Cull", (int)CullMode.Off);
}
else
{
material.SetInt("_Cull", (int)CullMode.Back);
}
if (def.PbrMetallicRoughness != null)
{
var pbr = def.PbrMetallicRoughness;
material.SetColor("_Color", pbr.BaseColorFactor.ToUnityColor());
if (pbr.BaseColorTexture != null)
{
var textureDef = pbr.BaseColorTexture.Index.Value;
material.SetTexture("_MainTex", CreateTexture(textureDef));
ApplyTextureTransform(pbr.BaseColorTexture, material, "_MainTex");
}
material.SetFloat("_Metallic", (float)pbr.MetallicFactor);
if (pbr.MetallicRoughnessTexture != null)
{
var texture = pbr.MetallicRoughnessTexture.Index.Value;
material.SetTexture("_MetallicRoughnessMap", CreateTexture(texture));
ApplyTextureTransform(pbr.MetallicRoughnessTexture, material, "_MetallicRoughnessMap");
}
material.SetFloat("_Roughness", (float)pbr.RoughnessFactor);
}
if (def.Extensions != null && def.Extensions.ContainsKey(KHR_materials_pbrSpecularGlossinessExtensionFactory.EXTENSION_NAME))
{
KHR_materials_pbrSpecularGlossinessExtension specGloss = def.Extensions[KHR_materials_pbrSpecularGlossinessExtensionFactory.EXTENSION_NAME] as KHR_materials_pbrSpecularGlossinessExtension;
if (specGloss.DiffuseTexture != null)
{
var texture = specGloss.DiffuseTexture.Index.Value;
material.SetTexture("_MainTex", CreateTexture(texture));
ApplyTextureTransform(specGloss.DiffuseTexture, material, "_MainTex");
}
else
{
material.SetColor("_Color", specGloss.DiffuseFactor.ToUnityColor());
}
if (specGloss.SpecularGlossinessTexture != null)
{
var texture = specGloss.SpecularGlossinessTexture.Index.Value;
material.SetTexture("_SpecGlossMap", CreateTexture(texture));
material.EnableKeyword("_SPECGLOSSMAP");
ApplyTextureTransform(specGloss.SpecularGlossinessTexture, material, "_SpecGlossMap");
}
else
{
material.SetVector("_SpecColor", specGloss.SpecularFactor.ToUnityVector3());
material.SetFloat("_Glossiness", (float)specGloss.GlossinessFactor);
}
}
if (def.CommonConstant != null)
{
material.SetColor("_AmbientFactor", def.CommonConstant.AmbientFactor.ToUnityColor());
if (def.CommonConstant.LightmapTexture != null)
{
material.EnableKeyword("LIGHTMAP_ON");
var texture = def.CommonConstant.LightmapTexture.Index.Value;
material.SetTexture("_LightMap", CreateTexture(texture));
material.SetInt("_LightUV", def.CommonConstant.LightmapTexture.TexCoord);
ApplyTextureTransform(def.CommonConstant.LightmapTexture, material, "_LightMap");
}
material.SetColor("_LightFactor", def.CommonConstant.LightmapFactor.ToUnityColor());
}
if (def.NormalTexture != null)
{
var texture = def.NormalTexture.Index.Value;
material.SetTexture("_BumpMap", CreateTexture(texture));
material.SetFloat("_BumpScale", (float)def.NormalTexture.Scale);
material.EnableKeyword("_NORMALMAP");
ApplyTextureTransform(def.NormalTexture, material, "_BumpMap");
}
if (def.OcclusionTexture != null)
{
var texture = def.OcclusionTexture.Index;
material.SetFloat("_OcclusionStrength", (float)def.OcclusionTexture.Strength);
if (def.PbrMetallicRoughness != null
&& def.PbrMetallicRoughness.MetallicRoughnessTexture != null
&& def.PbrMetallicRoughness.MetallicRoughnessTexture.Index.Id == texture.Id)
{
material.EnableKeyword("OCC_METAL_ROUGH_ON");
}
else
{
material.SetTexture("_OcclusionMap", CreateTexture(texture.Value));
ApplyTextureTransform(def.OcclusionTexture, material, "_OcclusionMap");
}
}
if (def.EmissiveTexture != null)
{
var texture = def.EmissiveTexture.Index.Value;
material.EnableKeyword("EMISSION_MAP_ON");
material.EnableKeyword("_EMISSION");
material.SetTexture("_EmissionMap", CreateTexture(texture));
material.SetInt("_EmissionUV", def.EmissiveTexture.TexCoord);
ApplyTextureTransform(def.EmissiveTexture, material, "_EmissionMap");
}
material.SetColor("_EmissionColor", def.EmissiveFactor.ToUnityColor());
materialWrapper = new MaterialCacheData
{
UnityMaterial = material,
UnityMaterialWithVertexColor = new UnityEngine.Material(material),
GLTFMaterial = def
};
materialWrapper.UnityMaterialWithVertexColor.EnableKeyword("VERTEX_COLOR_ON");
if (materialIndex > 0)
{
_assetCache.MaterialCache[materialIndex] = materialWrapper;
}
}
return materialIndex > 0 ? _assetCache.MaterialCache[materialIndex] : materialWrapper;
}
protected virtual UnityEngine.Texture CreateTexture(GLTF.Schema.Texture texture)
{
if (_assetCache.TextureCache[texture.Source.Id] == null)
{
var source = _assetCache.ImageCache[texture.Source.Id];
var desiredFilterMode = FilterMode.Bilinear;
var desiredWrapMode = UnityEngine.TextureWrapMode.Repeat;
if (texture.Sampler != null)
{
var sampler = texture.Sampler.Value;
switch (sampler.MinFilter)
{
case MinFilterMode.Nearest:
desiredFilterMode = FilterMode.Point;
break;
case MinFilterMode.Linear:
default:
desiredFilterMode = FilterMode.Bilinear;
break;
}
switch (sampler.WrapS)
{
case GLTF.Schema.WrapMode.ClampToEdge:
desiredWrapMode = UnityEngine.TextureWrapMode.Clamp;
break;
case GLTF.Schema.WrapMode.Repeat:
default:
desiredWrapMode = UnityEngine.TextureWrapMode.Repeat;
break;
}
}
if (source.filterMode == desiredFilterMode && source.wrapMode == desiredWrapMode)
{
_assetCache.TextureCache[texture.Source.Id] = source;
}
else
{
var unityTexture = UnityEngine.Object.Instantiate(source);
unityTexture.filterMode = desiredFilterMode;
unityTexture.wrapMode = desiredWrapMode;
_assetCache.TextureCache[texture.Source.Id] = unityTexture;
}
}
return _assetCache.TextureCache[texture.Source.Id];
}
protected virtual void ApplyTextureTransform(TextureInfo def, UnityEngine.Material mat, string texName)
{
Extension extension;
if (_root.ExtensionsUsed != null &&
_root.ExtensionsUsed.Contains(ExtTextureTransformExtensionFactory.EXTENSION_NAME) &&
def.Extensions != null &&
def.Extensions.TryGetValue(ExtTextureTransformExtensionFactory.EXTENSION_NAME, out extension))
{
ExtTextureTransformExtension ext = (ExtTextureTransformExtension)extension;
Vector2 temp = ext.Offset.ToUnityVector2();
temp = new Vector2(temp.x, -temp.y);
mat.SetTextureOffset(texName, temp);
mat.SetTextureScale(texName, ext.Scale.ToUnityVector2());
}
}
protected const string Base64StringInitializer = "^data:[a-z-]+/[a-z-]+;base64,";
protected virtual IEnumerator LoadImage(string rootPath, Image image, int imageID)
{
if (_assetCache.ImageCache[imageID] == null)
{
Texture2D texture = null;
if (image.Uri != null)
{
var uri = image.Uri;
Regex regex = new Regex(Base64StringInitializer);
Match match = regex.Match(uri);
if (match.Success)
{
var base64Data = uri.Substring(match.Length);
var textureData = Convert.FromBase64String(base64Data);
texture = new Texture2D(0, 0);
texture.LoadImage(textureData);
}
else if (_loadType == LoadType.Uri)
{
var www = UnityWebRequest.Get(Path.Combine(rootPath, uri));
www.downloadHandler = new DownloadHandlerTexture();
#if UNITY_2017_2_OR_NEWER
yield return www.SendWebRequest();
#else
yield return www.Send();
#endif
// HACK to enable mipmaps :(
var tempTexture = DownloadHandlerTexture.GetContent(www);
if (tempTexture != null)
{
texture = new Texture2D(tempTexture.width, tempTexture.height, tempTexture.format, true);
texture.SetPixels(tempTexture.GetPixels());
texture.Apply(true);
}
else
{
Debug.LogFormat("{0} {1}", www.responseCode, www.url);
texture = new Texture2D(16, 16);
}
}
else if (_loadType == LoadType.Stream)
{
var pathToLoad = Path.Combine(rootPath, uri);
var file = File.OpenRead(pathToLoad);
byte[] bufferData = new byte[file.Length];
file.Read(bufferData, 0, (int)file.Length);
#if !WINDOWS_UWP
file.Close();
#else
file.Dispose();
#endif
texture = new Texture2D(0, 0);
texture.LoadImage(bufferData);
}
}
else
{
texture = new Texture2D(0, 0);
var bufferView = image.BufferView.Value;
var buffer = bufferView.Buffer.Value;
var data = new byte[bufferView.ByteLength];
var bufferContents = _assetCache.BufferCache[bufferView.Buffer.Id];
System.Buffer.BlockCopy(bufferContents, bufferView.ByteOffset, data, 0, data.Length);
texture.LoadImage(data);
}
_assetCache.ImageCache[imageID] = texture;
}
}
/// <summary>
/// Load the remote URI data into a byte array.
/// </summary>
protected virtual IEnumerator LoadBuffer(string sourceUri, GLTF.Schema.Buffer buffer, int bufferIndex)
{
if (buffer.Uri != null)
{
byte[] bufferData = null;
var uri = buffer.Uri;
Regex regex = new Regex(Base64StringInitializer);
Match match = regex.Match(uri);
if (match.Success)
{
var base64Data = uri.Substring(match.Length);
bufferData = Convert.FromBase64String(base64Data);
}
else if (_loadType == LoadType.Uri)
{
var www = UnityWebRequest.Get(Path.Combine(sourceUri, uri));
#if UNITY_2017_2_OR_NEWER
yield return www.SendWebRequest();
#else
yield return www.Send();
#endif
bufferData = www.downloadHandler.data;
}
else if (_loadType == LoadType.Stream)
{
var pathToLoad = Path.Combine(sourceUri, uri);
var file = File.OpenRead(pathToLoad);
bufferData = new byte[buffer.ByteLength];
file.Read(bufferData, 0, buffer.ByteLength);
#if !WINDOWS_UWP
file.Close();
#else
file.Dispose();
#endif
}
_assetCache.BufferCache[bufferIndex] = bufferData;
}
}
/// <summary>
/// Get the absolute path to a gltf uri reference.
/// </summary>
/// <param name="gltfPath">The path to the gltf file</param>
/// <returns>A path without the filename or extension</returns>
protected static string AbsoluteUriPath(string gltfPath)
{
var uri = new Uri(gltfPath);
var partialPath = uri.AbsoluteUri.Remove(uri.AbsoluteUri.Length - uri.Query.Length - uri.Segments[uri.Segments.Length - 1].Length);
return partialPath;
}
/// <summary>
/// Get the absolute path a gltf file directory
/// </summary>
/// <param name="gltfPath">The path to the gltf file</param>
/// <returns>A path without the filename or extension</returns>
protected static string AbsoluteFilePath(string gltfPath)
{
var fileName = Path.GetFileName(gltfPath);
var lastIndex = gltfPath.IndexOf(fileName);
var partialPath = gltfPath.Substring(0, lastIndex);
return partialPath;
}
}
}
| 43.973624 | 209 | 0.528726 | [
"MIT"
] | Dennou-Coil/HoloGPSReceiver | Assets/HoloToolkit/Utilities/Scripts/GLTF/Scripts/GLTFSceneImporter.cs | 38,345 | C# |
using Cysharp.Threading.Tasks;
namespace EVANGELION
{
using UnityEngine;
public class ScreenBase
{
public virtual string mResName { get; }
public GameObject mPanelRoot = null;
protected UICtrlBase mCtrlBase;
public int mOpenOrder = 0; // 界面打开顺序
public int mSortingLayer = 0; // 界面层级
// 界面打开的传入参数
protected UIOpenScreenParameterBase mOpenParam;
public UICtrlBase CtrlBase
{
get => mCtrlBase;
}
public async UniTask StartLoad( UIOpenScreenParameterBase param = null)
{
mOpenParam = param;
var ctrl = Object.Instantiate(Resources.Load<GameObject>("Prefabs/UI/"+mResName),ELUIManager.Ins.GetUIRootTransform());
await PanelLoadComplete(ctrl);
}
// 资源加载完成
async UniTask PanelLoadComplete(GameObject ctrl)
{
mPanelRoot = ctrl;
// 获取控件对象
mCtrlBase = mPanelRoot.GetComponent<UICtrlBase>();
// 更新层级信息
UpdateLayoutLevel();
// 调用加载成功方法
await OnLoadSuccess();
// 添加到控制层
ELUIManager.Ins.AddUI(this);
}
// 脚本处理完成
#pragma warning disable 1998
protected virtual async UniTask OnLoadSuccess()
#pragma warning restore 1998
{
}
public virtual void OnClose()
{
ELUIManager.Ins.RemoveUI(this);
}
// 设置渲染顺序
public void SetOpenOrder(int openOrder)
{
mOpenOrder = openOrder;
if (mCtrlBase != null && mCtrlBase.ctrlCanvas != null)
{
mCtrlBase.ctrlCanvas.sortingOrder = openOrder;
}
}
// 更新UI的层级
private void UpdateLayoutLevel()
{
var camera = ELUIManager.Ins.GetUICamera();
if (camera != null)
{
mCtrlBase.ctrlCanvas.worldCamera = camera;
}
mCtrlBase.ctrlCanvas.pixelPerfect = true;
mCtrlBase.ctrlCanvas.overrideSorting = true;
mCtrlBase.ctrlCanvas.sortingLayerID = (int) mCtrlBase.sceenPriority;
mSortingLayer = (int) mCtrlBase.sceenPriority;
mCtrlBase.ctrlCanvas.sortingOrder = mOpenOrder;
}
public virtual void Dispose()
{
Object.Destroy(mPanelRoot);
}
}
} | 25.030303 | 131 | 0.546408 | [
"MIT"
] | sunny2019/EVANGELION-01-Quick | Assets/Scripts/EVANGELION/UI/Framework/ScreenBase/ScreenBase.cs | 2,616 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
/*
* Do not modify this file. This file is generated from the savingsplans-2019-06-28.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.SavingsPlans.Model
{
/// <summary>
/// Information about a property.
/// </summary>
public partial class SavingsPlanRateProperty
{
private SavingsPlanRatePropertyKey _name;
private string _value;
/// <summary>
/// Gets and sets the property Name.
/// <para>
/// The property name.
/// </para>
/// </summary>
public SavingsPlanRatePropertyKey Name
{
get { return this._name; }
set { this._name = value; }
}
// Check to see if Name property is set
internal bool IsSetName()
{
return this._name != null;
}
/// <summary>
/// Gets and sets the property Value.
/// <para>
/// The property value.
/// </para>
/// </summary>
public string Value
{
get { return this._value; }
set { this._value = value; }
}
// Check to see if Value property is set
internal bool IsSetValue()
{
return this._value != null;
}
}
} | 27.710526 | 111 | 0.581197 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/SavingsPlans/Generated/Model/SavingsPlanRateProperty.cs | 2,106 | C# |
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Runtime.CompilerServices;
namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components
{
/// <summary>
/// Performs the inverse Descrete Cosine Transform on each frame component.
/// </summary>
internal static class PdfJsIDCT
{
/// <summary>
/// Precomputed values scaled up by 14 bits
/// </summary>
public static readonly short[] Aanscales =
{
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 22725, 31521, 29692, 26722, 22725, 17855,
12299, 6270, 21407, 29692, 27969, 25172, 21407, 16819, 11585,
5906, 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 12873,
17855, 16819, 15137, 12873, 10114, 6967, 3552, 8867, 12299,
11585, 10426, 8867, 6967, 4799, 2446, 4520, 6270, 5906, 5315,
4520, 3552, 2446, 1247
};
private const int DctCos1 = 4017; // cos(pi/16)
private const int DctSin1 = 799; // sin(pi/16)
private const int DctCos3 = 3406; // cos(3*pi/16)
private const int DctSin3 = 2276; // sin(3*pi/16)
private const int DctCos6 = 1567; // cos(6*pi/16)
private const int DctSin6 = 3784; // sin(6*pi/16)
private const int DctSqrt2 = 5793; // sqrt(2)
private const int DctSqrt1D2 = 2896; // sqrt(2) / 2
#pragma warning disable SA1310 // Field names must not contain underscore
private const int FIX_1_082392200 = 277; // FIX(1.082392200)
private const int FIX_1_414213562 = 362; // FIX(1.414213562)
private const int FIX_1_847759065 = 473; // FIX(1.847759065)
private const int FIX_2_613125930 = 669; // FIX(2.613125930)
#pragma warning restore SA1310 // Field names must not contain underscore
private const int ConstBits = 8;
private const int Pass1Bits = 2; // Factional bits in scale factors
private const int MaxJSample = 255;
private const int CenterJSample = 128;
private const int RangeCenter = (MaxJSample * 2) + 2;
// First segment of range limit table: limit[x] = 0 for x < 0
// allow negative subscripts of simple table
private const int TableOffset = 2 * (MaxJSample + 1);
private const int LimitOffset = TableOffset - (RangeCenter - CenterJSample);
// Each IDCT routine is responsible for range-limiting its results and
// converting them to unsigned form (0..MaxJSample). The raw outputs could
// be quite far out of range if the input data is corrupt, so a bulletproof
// range-limiting step is required. We use a mask-and-table-lookup method
// to do the combined operations quickly, assuming that MaxJSample+1
// is a power of 2.
private const int RangeMask = (MaxJSample * 4) + 3; // 2 bits wider than legal samples
private static readonly byte[] Limit = new byte[5 * (MaxJSample + 1)];
static PdfJsIDCT()
{
// Main part of range limit table: limit[x] = x
int i;
for (i = 0; i <= MaxJSample; i++)
{
Limit[TableOffset + i] = (byte)i;
}
// End of range limit table: Limit[x] = MaxJSample for x > MaxJSample
for (; i < 3 * (MaxJSample + 1); i++)
{
Limit[TableOffset + i] = MaxJSample;
}
}
/// <summary>
/// A port of Poppler's IDCT method which in turn is taken from:
/// Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz,
/// 'Practical Fast 1-D DCT Algorithms with 11 Multiplications',
/// IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989, 988-991.
/// </summary>
/// <param name="component">The fram component</param>
/// <param name="blockBufferOffset">The block buffer offset</param>
/// <param name="computationBuffer">The computational buffer for holding temp values</param>
/// <param name="quantizationTable">The quantization table</param>
public static void QuantizeAndInverse(PdfJsFrameComponent component, int blockBufferOffset, ref Span<short> computationBuffer, ref Span<short> quantizationTable)
{
Span<short> blockData = component.BlockData.Slice(blockBufferOffset);
int v0, v1, v2, v3, v4, v5, v6, v7;
int p0, p1, p2, p3, p4, p5, p6, p7;
int t;
// inverse DCT on rows
for (int row = 0; row < 64; row += 8)
{
// gather block data
p0 = blockData[row];
p1 = blockData[row + 1];
p2 = blockData[row + 2];
p3 = blockData[row + 3];
p4 = blockData[row + 4];
p5 = blockData[row + 5];
p6 = blockData[row + 6];
p7 = blockData[row + 7];
// dequant p0
p0 *= quantizationTable[row];
// check for all-zero AC coefficients
if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) == 0)
{
t = ((DctSqrt2 * p0) + 512) >> 10;
short st = (short)t;
computationBuffer[row] = st;
computationBuffer[row + 1] = st;
computationBuffer[row + 2] = st;
computationBuffer[row + 3] = st;
computationBuffer[row + 4] = st;
computationBuffer[row + 5] = st;
computationBuffer[row + 6] = st;
computationBuffer[row + 7] = st;
continue;
}
// dequant p1 ... p7
p1 *= quantizationTable[row + 1];
p2 *= quantizationTable[row + 2];
p3 *= quantizationTable[row + 3];
p4 *= quantizationTable[row + 4];
p5 *= quantizationTable[row + 5];
p6 *= quantizationTable[row + 6];
p7 *= quantizationTable[row + 7];
// stage 4
v0 = ((DctSqrt2 * p0) + 128) >> 8;
v1 = ((DctSqrt2 * p4) + 128) >> 8;
v2 = p2;
v3 = p6;
v4 = ((DctSqrt1D2 * (p1 - p7)) + 128) >> 8;
v7 = ((DctSqrt1D2 * (p1 + p7)) + 128) >> 8;
v5 = p3 << 4;
v6 = p5 << 4;
// stage 3
v0 = (v0 + v1 + 1) >> 1;
v1 = v0 - v1;
t = ((v2 * DctSin6) + (v3 * DctCos6) + 128) >> 8;
v2 = ((v2 * DctCos6) - (v3 * DctSin6) + 128) >> 8;
v3 = t;
v4 = (v4 + v6 + 1) >> 1;
v6 = v4 - v6;
v7 = (v7 + v5 + 1) >> 1;
v5 = v7 - v5;
// stage 2
v0 = (v0 + v3 + 1) >> 1;
v3 = v0 - v3;
v1 = (v1 + v2 + 1) >> 1;
v2 = v1 - v2;
t = ((v4 * DctSin3) + (v7 * DctCos3) + 2048) >> 12;
v4 = ((v4 * DctCos3) - (v7 * DctSin3) + 2048) >> 12;
v7 = t;
t = ((v5 * DctSin1) + (v6 * DctCos1) + 2048) >> 12;
v5 = ((v5 * DctCos1) - (v6 * DctSin1) + 2048) >> 12;
v6 = t;
// stage 1
computationBuffer[row] = (short)(v0 + v7);
computationBuffer[row + 7] = (short)(v0 - v7);
computationBuffer[row + 1] = (short)(v1 + v6);
computationBuffer[row + 6] = (short)(v1 - v6);
computationBuffer[row + 2] = (short)(v2 + v5);
computationBuffer[row + 5] = (short)(v2 - v5);
computationBuffer[row + 3] = (short)(v3 + v4);
computationBuffer[row + 4] = (short)(v3 - v4);
}
// inverse DCT on columns
for (int col = 0; col < 8; ++col)
{
p0 = computationBuffer[col];
p1 = computationBuffer[col + 8];
p2 = computationBuffer[col + 16];
p3 = computationBuffer[col + 24];
p4 = computationBuffer[col + 32];
p5 = computationBuffer[col + 40];
p6 = computationBuffer[col + 48];
p7 = computationBuffer[col + 56];
// check for all-zero AC coefficients
if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) == 0)
{
t = ((DctSqrt2 * p0) + 8192) >> 14;
// convert to 8 bit
t = (t < -2040) ? 0 : (t >= 2024) ? MaxJSample : (t + 2056) >> 4;
short st = (short)t;
blockData[col] = st;
blockData[col + 8] = st;
blockData[col + 16] = st;
blockData[col + 24] = st;
blockData[col + 32] = st;
blockData[col + 40] = st;
blockData[col + 48] = st;
blockData[col + 56] = st;
continue;
}
// stage 4
v0 = ((DctSqrt2 * p0) + 2048) >> 12;
v1 = ((DctSqrt2 * p4) + 2048) >> 12;
v2 = p2;
v3 = p6;
v4 = ((DctSqrt1D2 * (p1 - p7)) + 2048) >> 12;
v7 = ((DctSqrt1D2 * (p1 + p7)) + 2048) >> 12;
v5 = p3;
v6 = p5;
// stage 3
// Shift v0 by 128.5 << 5 here, so we don't need to shift p0...p7 when
// converting to UInt8 range later.
v0 = ((v0 + v1 + 1) >> 1) + 4112;
v1 = v0 - v1;
t = ((v2 * DctSin6) + (v3 * DctCos6) + 2048) >> 12;
v2 = ((v2 * DctCos6) - (v3 * DctSin6) + 2048) >> 12;
v3 = t;
v4 = (v4 + v6 + 1) >> 1;
v6 = v4 - v6;
v7 = (v7 + v5 + 1) >> 1;
v5 = v7 - v5;
// stage 2
v0 = (v0 + v3 + 1) >> 1;
v3 = v0 - v3;
v1 = (v1 + v2 + 1) >> 1;
v2 = v1 - v2;
t = ((v4 * DctSin3) + (v7 * DctCos3) + 2048) >> 12;
v4 = ((v4 * DctCos3) - (v7 * DctSin3) + 2048) >> 12;
v7 = t;
t = ((v5 * DctSin1) + (v6 * DctCos1) + 2048) >> 12;
v5 = ((v5 * DctCos1) - (v6 * DctSin1) + 2048) >> 12;
v6 = t;
// stage 1
p0 = v0 + v7;
p7 = v0 - v7;
p1 = v1 + v6;
p6 = v1 - v6;
p2 = v2 + v5;
p5 = v2 - v5;
p3 = v3 + v4;
p4 = v3 - v4;
// convert to 8-bit integers
p0 = (p0 < 16) ? 0 : (p0 >= 4080) ? MaxJSample : p0 >> 4;
p1 = (p1 < 16) ? 0 : (p1 >= 4080) ? MaxJSample : p1 >> 4;
p2 = (p2 < 16) ? 0 : (p2 >= 4080) ? MaxJSample : p2 >> 4;
p3 = (p3 < 16) ? 0 : (p3 >= 4080) ? MaxJSample : p3 >> 4;
p4 = (p4 < 16) ? 0 : (p4 >= 4080) ? MaxJSample : p4 >> 4;
p5 = (p5 < 16) ? 0 : (p5 >= 4080) ? MaxJSample : p5 >> 4;
p6 = (p6 < 16) ? 0 : (p6 >= 4080) ? MaxJSample : p6 >> 4;
p7 = (p7 < 16) ? 0 : (p7 >= 4080) ? MaxJSample : p7 >> 4;
// store block data
blockData[col] = (short)p0;
blockData[col + 8] = (short)p1;
blockData[col + 16] = (short)p2;
blockData[col + 24] = (short)p3;
blockData[col + 32] = (short)p4;
blockData[col + 40] = (short)p5;
blockData[col + 48] = (short)p6;
blockData[col + 56] = (short)p7;
}
}
/// <summary>
/// A port of <see href="https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/jidctfst.c#L171"/>
/// A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
/// on each row(or vice versa, but it's more convenient to emit a row at
/// a time). Direct algorithms are also available, but they are much more
/// complex and seem not to be any faster when reduced to code.
///
/// This implementation is based on Arai, Agui, and Nakajima's algorithm for
/// scaled DCT.Their original paper (Trans.IEICE E-71(11):1095) is in
/// Japanese, but the algorithm is described in the Pennebaker & Mitchell
/// JPEG textbook(see REFERENCES section in file README.ijg). The following
/// code is based directly on figure 4-8 in P&M.
/// While an 8-point DCT cannot be done in less than 11 multiplies, it is
/// possible to arrange the computation so that many of the multiplies are
/// simple scalings of the final outputs.These multiplies can then be
/// folded into the multiplications or divisions by the JPEG quantization
/// table entries. The AA&N method leaves only 5 multiplies and 29 adds
/// to be done in the DCT itself.
/// The primary disadvantage of this method is that with fixed-point math,
/// accuracy is lost due to imprecise representation of the scaled
/// quantization values.The smaller the quantization table entry, the less
/// precise the scaled value, so this implementation does worse with high -
/// quality - setting files than with low - quality ones.
/// </summary>
/// <param name="component">The frame component</param>
/// <param name="blockBufferOffset">The block buffer offset</param>
/// <param name="computationBuffer">The computational buffer for holding temp values</param>
/// <param name="multiplierTable">The multiplier table</param>
public static void QuantizeAndInverseFast(PdfJsFrameComponent component, int blockBufferOffset, ref Span<short> computationBuffer, ref Span<short> multiplierTable)
{
Span<short> blockData = component.BlockData.Slice(blockBufferOffset);
int p0, p1, p2, p3, p4, p5, p6, p7;
for (int col = 0; col < 8; col++)
{
// Gather block data
p0 = blockData[col];
p1 = blockData[col + 8];
p2 = blockData[col + 16];
p3 = blockData[col + 24];
p4 = blockData[col + 32];
p5 = blockData[col + 40];
p6 = blockData[col + 48];
p7 = blockData[col + 56];
int tmp0 = p0 * multiplierTable[col];
// Due to quantization, we will usually find that many of the input
// coefficients are zero, especially the AC terms. We can exploit this
// by short-circuiting the IDCT calculation for any column in which all
// the AC terms are zero. In that case each output is equal to the
// DC coefficient (with scale factor as needed).
// With typical images and quantization tables, half or more of the
// column DCT calculations can be simplified this way.
if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) == 0)
{
short dcval = (short)tmp0;
computationBuffer[col] = dcval;
computationBuffer[col + 8] = dcval;
computationBuffer[col + 16] = dcval;
computationBuffer[col + 24] = dcval;
computationBuffer[col + 32] = dcval;
computationBuffer[col + 40] = dcval;
computationBuffer[col + 48] = dcval;
computationBuffer[col + 56] = dcval;
continue;
}
// Even part
int tmp1 = p2 * multiplierTable[col + 16];
int tmp2 = p4 * multiplierTable[col + 32];
int tmp3 = p6 * multiplierTable[col + 48];
int tmp10 = tmp0 + tmp2; // Phase 3
int tmp11 = tmp0 - tmp2;
int tmp13 = tmp1 + tmp3; // Phases 5-3
int tmp12 = Multiply(tmp1 - tmp3, FIX_1_414213562) - tmp13; // 2*c4
tmp0 = tmp10 + tmp13; // Phase 2
tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
// Odd Part
int tmp4 = p1 * multiplierTable[col + 8];
int tmp5 = p3 * multiplierTable[col + 24];
int tmp6 = p5 * multiplierTable[col + 40];
int tmp7 = p7 * multiplierTable[col + 56];
int z13 = tmp6 + tmp5; // Phase 6
int z10 = tmp6 - tmp5;
int z11 = tmp4 + tmp7;
int z12 = tmp4 - tmp7;
tmp7 = z11 + z13; // Phase 5
tmp11 = Multiply(z11 - z13, FIX_1_414213562); // 2*c4
int z5 = Multiply(z10 + z12, FIX_1_847759065); // 2*c2
tmp10 = z5 - Multiply(z12, FIX_1_082392200); // 2*(c2-c6)
tmp12 = z5 - Multiply(z10, FIX_2_613125930); // 2*(c2+c6)
tmp6 = tmp12 - tmp7; // Phase 2
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 - tmp5;
computationBuffer[col] = (short)(tmp0 + tmp7);
computationBuffer[col + 56] = (short)(tmp0 - tmp7);
computationBuffer[col + 8] = (short)(tmp1 + tmp6);
computationBuffer[col + 48] = (short)(tmp1 - tmp6);
computationBuffer[col + 16] = (short)(tmp2 + tmp5);
computationBuffer[col + 40] = (short)(tmp2 - tmp5);
computationBuffer[col + 24] = (short)(tmp3 + tmp4);
computationBuffer[col + 32] = (short)(tmp3 - tmp4);
}
// Pass 2: process rows from work array, store into output array.
// Note that we must descale the results by a factor of 8 == 2**3,
// and also undo the pass 1 bits scaling.
for (int row = 0; row < 64; row += 8)
{
p1 = computationBuffer[row + 1];
p2 = computationBuffer[row + 2];
p3 = computationBuffer[row + 3];
p4 = computationBuffer[row + 4];
p5 = computationBuffer[row + 5];
p6 = computationBuffer[row + 6];
p7 = computationBuffer[row + 7];
// Add range center and fudge factor for final descale and range-limit.
int z5 = computationBuffer[row] + (RangeCenter << (Pass1Bits + 3)) + (1 << (Pass1Bits + 2));
// Check for all-zero AC coefficients
if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) == 0)
{
byte dcval = Limit[LimitOffset + (RightShift(z5, Pass1Bits + 3) & RangeMask)];
blockData[row] = dcval;
blockData[row + 1] = dcval;
blockData[row + 2] = dcval;
blockData[row + 3] = dcval;
blockData[row + 4] = dcval;
blockData[row + 5] = dcval;
blockData[row + 6] = dcval;
blockData[row + 7] = dcval;
continue;
}
// Even part
int tmp10 = z5 + p4;
int tmp11 = z5 - p4;
int tmp13 = p2 + p6;
int tmp12 = Multiply(p2 - p6, FIX_1_414213562) - tmp13; // 2*c4
int tmp0 = tmp10 + tmp13;
int tmp3 = tmp10 - tmp13;
int tmp1 = tmp11 + tmp12;
int tmp2 = tmp11 - tmp12;
// Odd part
int z13 = p5 + p3;
int z10 = p5 - p3;
int z11 = p1 + p7;
int z12 = p1 - p7;
int tmp7 = z11 + z13; // Phase 5
tmp11 = Multiply(z11 - z13, FIX_1_414213562); // 2*c4
z5 = Multiply(z10 + z12, FIX_1_847759065); // 2*c2
tmp10 = z5 - Multiply(z12, FIX_1_082392200); // 2*(c2-c6)
tmp12 = z5 - Multiply(z10, FIX_2_613125930); // 2*(c2+c6)
int tmp6 = tmp12 - tmp7; // Phase 2
int tmp5 = tmp11 - tmp6;
int tmp4 = tmp10 - tmp5;
// Final output stage: scale down by a factor of 8, offset, and range-limit
blockData[row] = Limit[LimitOffset + (RightShift(tmp0 + tmp7, Pass1Bits + 3) & RangeMask)];
blockData[row + 7] = Limit[LimitOffset + (RightShift(tmp0 - tmp7, Pass1Bits + 3) & RangeMask)];
blockData[row + 1] = Limit[LimitOffset + (RightShift(tmp1 + tmp6, Pass1Bits + 3) & RangeMask)];
blockData[row + 6] = Limit[LimitOffset + (RightShift(tmp1 - tmp6, Pass1Bits + 3) & RangeMask)];
blockData[row + 2] = Limit[LimitOffset + (RightShift(tmp2 + tmp5, Pass1Bits + 3) & RangeMask)];
blockData[row + 5] = Limit[LimitOffset + (RightShift(tmp2 - tmp5, Pass1Bits + 3) & RangeMask)];
blockData[row + 3] = Limit[LimitOffset + (RightShift(tmp3 + tmp4, Pass1Bits + 3) & RangeMask)];
blockData[row + 4] = Limit[LimitOffset + (RightShift(tmp3 - tmp4, Pass1Bits + 3) & RangeMask)];
}
}
/// <summary>
/// Descale and correctly round an int value that's scaled by <paramref name="n"/> bits.
/// We assume <see cref="RightShift"/> rounds towards minus infinity, so adding
/// the fudge factor is correct for either sign of <paramref name="value"/>.
/// </summary>
/// <param name="value">The value</param>
/// <param name="n">The number of bits</param>
/// <returns>The <see cref="int"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Descale(int value, int n)
{
return RightShift(value + (1 << (n - 1)), n);
}
/// <summary>
/// Multiply a variable by an int constant, and immediately descale.
/// </summary>
/// <param name="val">The value</param>
/// <param name="c">The multiplier</param>
/// <returns>The <see cref="int"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int Multiply(int val, int c)
{
return Descale(val * c, ConstBits);
}
/// <summary>
/// Right-shifts the value by the given amount
/// </summary>
/// <param name="value">The value</param>
/// <param name="shift">The amount to shift by</param>
/// <returns>The <see cref="int"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int RightShift(int value, int shift)
{
return value >> shift;
}
}
} | 45.410156 | 171 | 0.484172 | [
"Apache-2.0"
] | axunonb/ImageSharp | src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsIDCT.cs | 23,252 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Tools.Parser.Parsers;
using Tools.Parser.Units;
namespace Tools.Parser
{
using File = Units.File;
using Type = Units.Type;
using ClangSharp;
public class ClangParser : Parser
{
public string Root { get; private set; }
public override IEnumerable<File> Files
{
get
{
return files;
}
}
public IEnumerable<Namespace> Namespaces
{
get
{
return namespaces;
}
}
public IEnumerable<Type> Types
{
get
{
return types;
}
}
private CXIndex index;
private Dictionary<CXCursor, Unit> units = new Dictionary<CXCursor, Unit>();
private Dictionary<Type, Modifiers> modifiers = new Dictionary<Type, Modifiers>();
private List<Field> properties = new List<Field>();
private List<CppFile> files = new List<CppFile>();
private List<CppNamespace> namespaces = new List<CppNamespace>();
private List<Type> types = new List<Type>();
public ClangParser(string root)
{
Root = root;
index = clang.createIndex(0, 0);
}
public override void AddFile(string path)
{
if (!Path.IsPathRooted(path))
path = Path.Combine(Root, path);
CXUnsavedFile unsavedFile;
CXTranslationUnit translationUnit;
CXErrorCode error;
string[] args =
{
"-x", "c++",
"-I", Root,
"-std=c++11",
"-fms-extensions"
};
error = clang.parseTranslationUnit2(index, path, args, 6, out unsavedFile, 0, 0, out translationUnit);
if (error != CXErrorCode.CXError_Success)
{
Console.WriteLine("Error: " + error);
var numDiagnostics = clang.getNumDiagnostics(translationUnit);
for (uint i = 0; i < numDiagnostics; ++i)
{
var diagnostic = clang.getDiagnostic(translationUnit, i);
Console.WriteLine(clang.getDiagnosticSpelling(diagnostic).ToString());
clang.disposeDiagnostic(diagnostic);
}
}
clang.visitChildren(clang.getTranslationUnitCursor(translationUnit), Visit, new CXClientData(IntPtr.Zero));
}
/*public override void Resolve()
{
// List all namespaces
IEnumerable<Namespace> namespaces = Files.SelectMany(f => f.Namespaces);
for (; ;)
{
IEnumerable<Namespace> subNamespaces = namespaces.SelectMany(n => n.Namespaces).Except(namespaces);
if (!subNamespaces.Any())
break;
namespaces = namespaces.Concat(subNamespaces);
}
Namespaces.Clear();
Namespaces.AddRange(namespaces);
// List all types
IEnumerable<Type> types = Files.SelectMany(f => f.Types).Concat(Namespaces.SelectMany(n => n.Types));
for (; ;)
{
IEnumerable<Type> subTypes = types.SelectMany(t => t.Types).Where(t => t.Name != "").Except(types);
if (!subTypes.Any())
break;
types = types.Concat(subTypes);
}
Types.Clear();
Types.AddRange(types);
// Merge namespaces
for (int i = 0; i < Namespaces.Count; i++)
{
CppNamespace currentNamespace = Namespaces[i] as CppNamespace;
List<Namespace> otherNamespaces = Namespaces.Where(n => n != currentNamespace && n.Equals(currentNamespace)).ToList();
currentNamespace.Namespaces.AddRange(otherNamespaces.SelectMany(n => n.Namespaces)
.Select(n => { n.Parent = currentNamespace; return n; })
.ToList());
currentNamespace.Types.AddRange(otherNamespaces.SelectMany(n => n.Types)
.Select(t => { t.Parent = currentNamespace; return t; })
.ToList());
foreach (Namespace nameSpace in Namespaces)
foreach (Namespace otherNamespace in otherNamespaces)
nameSpace.Namespaces.Remove(otherNamespace);
foreach (Namespace otherNamespace in otherNamespaces)
Namespaces.Remove(otherNamespace);
}
foreach (Namespace ns in Namespaces)
if (ns.Parent is Namespace)
ns.Parent = Namespaces.First(n => n.Name == ns.Parent.Name);
foreach (Type type in Types)
if (type.Parent is Type)
type.Parent = Types.First(t => t.Name == type.Parent.Name);
// Methods
IEnumerable<Method> methods = types.SelectMany(t => t.Methods);
IEnumerable<Method> statics = types.SelectMany(t => t.Methods).Where(m => (m.Modifiers & Modifiers.Static) == Modifiers.Static);
// Resolve everything
foreach (File f in Files)
f.Resolve(Types);
// Remove getters and setters
/*foreach (Type type in Types)
{
foreach (Field field in type.Fields)
{
if (field.GetAccessor != null)
type.Methods.Remove(field.GetAccessor);
if (field.SetAccessor != null)
type.Methods.Remove(field.SetAccessor);
}
}*/
/*}*/
private CXChildVisitResult Visit(CXCursor cursor, CXCursor parent, IntPtr data)
{
if (!units.ContainsKey(parent))
{
CXCursorKind parentKind = clang.getCursorKind(parent);
string parentName = clang.getCString(clang.getCursorSpelling(parent));
if (parentKind != CXCursorKind.CXCursor_TranslationUnit)
throw new Exception("Root parents must be translation units");
CppFile file = new CppFile(parentName);
files.Add(file);
units.Add(parent, file);
}
CXCursorKind kind = clang.getCursorKind(cursor);
switch (kind)
{
case CXCursorKind.CXCursor_Namespace:
return VisitNamespace(cursor, parent, data);
case CXCursorKind.CXCursor_ClassDecl:
case CXCursorKind.CXCursor_StructDecl:
case CXCursorKind.CXCursor_EnumDecl:
case CXCursorKind.CXCursor_TypedefDecl:
case CXCursorKind.CXCursor_UnionDecl:
case CXCursorKind.CXCursor_ClassTemplate:
return VisitType(cursor, parent, data);
case CXCursorKind.CXCursor_CXXAccessSpecifier:
return VisitTypeModifier(cursor, parent, data);
case CXCursorKind.CXCursor_EnumConstantDecl:
return VisitEnumConstant(cursor, parent, data);
case CXCursorKind.CXCursor_FieldDecl:
case CXCursorKind.CXCursor_MemberRef:
case CXCursorKind.CXCursor_VarDecl:
return VisitField(cursor, parent, data);
case CXCursorKind.CXCursor_Constructor:
case CXCursorKind.CXCursor_Destructor:
case CXCursorKind.CXCursor_CXXMethod:
case CXCursorKind.CXCursor_FunctionDecl:
case CXCursorKind.CXCursor_FunctionTemplate:
return VisitMethod(cursor, parent, data);
case CXCursorKind.CXCursor_TemplateTypeParameter:
case CXCursorKind.CXCursor_NonTypeTemplateParameter:
return VisitTemplateParameter(cursor, parent, data);
case CXCursorKind.CXCursor_ParmDecl:
return VisitMethodParameter(cursor, parent, data);
case CXCursorKind.CXCursor_FirstDecl:
case CXCursorKind.CXCursor_TypeRef:
case CXCursorKind.CXCursor_NamespaceRef:
case CXCursorKind.CXCursor_CompoundStmt:
break;
default:
break;
}
return CXChildVisitResult.CXChildVisit_Continue;
}
private CXChildVisitResult VisitNamespace(CXCursor cursor, CXCursor parent, IntPtr data)
{
Unit unitParent = units[parent];
string unitName = clang.getCString(clang.getCursorSpelling(cursor));
CppNamespace unit = null;
// Try to find existing namespace
if (unitParent is File)
unit = namespaces.FirstOrDefault(n => n.Name == unitName);
else if (unitParent is Namespace)
unit = (unitParent as Namespace).Namespaces.FirstOrDefault(n => n.Name == unitName) as CppNamespace;
// Register the new namespace
if (unit == null)
{
unit = new CppNamespace(unitParent is CppFile ? null : unitParent, unitName);
if (unitParent is CppFile)
{
(unitParent as CppFile).namespaces.Add(unit);
namespaces.Add(unit);
}
else if (unitParent is CppNamespace)
(unitParent as CppNamespace).namespaces.Add(unit);
}
units.Add(cursor, unit);
return CXChildVisitResult.CXChildVisit_Recurse;
}
private CXChildVisitResult VisitType(CXCursor cursor, CXCursor parent, IntPtr data)
{
Unit unitParent = units[parent];
string unitName = clang.getCString(clang.getCursorSpelling(cursor));
Type unit = null;
// Try to find existing type
if (unitParent is File)
unit = types.FirstOrDefault(t => t.Name == unitName);
else if (unitParent is Namespace)
unit = (unitParent as Namespace).Types.FirstOrDefault(t => t.Name == unitName);
else if (unitParent is Type)
unit = (unitParent as Type).Types.FirstOrDefault(t => t.Name == unitName);
// Register the new type
if (unit == null)
{
CXCursorKind kind = clang.getCursorKind(cursor);
if (kind == CXCursorKind.CXCursor_TypedefDecl)
unit = new Type.Alias(unitName, FromCXType(clang.getTypedefDeclUnderlyingType(cursor)));
else
{
CppType cppUnit = new CppType(unitName);
switch (kind)
{
case CXCursorKind.CXCursor_ClassDecl: cppUnit.style = TypeStyle.Class; break;
case CXCursorKind.CXCursor_StructDecl: cppUnit.style = TypeStyle.Struct; break;
case CXCursorKind.CXCursor_UnionDecl: cppUnit.style = TypeStyle.Union; break;
case CXCursorKind.CXCursor_EnumDecl: cppUnit.style = TypeStyle.Enum; break;
}
if (unitParent is Type && modifiers.ContainsKey(unitParent as Type))
cppUnit.modifiers = modifiers[unitParent as Type];
unit = cppUnit;
}
if (unitParent is CppFile)
{
(unitParent as CppFile).types.Add(unit);
types.Add(unit);
}
else if (unitParent is CppNamespace)
(unitParent as CppNamespace).types.Add(unit);
else if (unitParent is CppType)
(unitParent as CppType).types.Add(unit);
}
unit.Parent = unitParent;
if (!units.ContainsKey(cursor))
units.Add(cursor, unit);
switch (unit.Style)
{
case TypeStyle.Class: modifiers[unit] = Modifiers.Private; break;
case TypeStyle.Struct: modifiers[unit] = Modifiers.Public; break;
case TypeStyle.Enum: modifiers[unit] = Modifiers.Public; break;
case TypeStyle.Union: modifiers[unit] = Modifiers.Public; break;
}
return CXChildVisitResult.CXChildVisit_Recurse;
}
private CXChildVisitResult VisitTypeModifier(CXCursor cursor, CXCursor parent, IntPtr data)
{
Type parentUnit = units[parent] as Type;
CX_CXXAccessSpecifier accessSpecifier = clang.getCXXAccessSpecifier(cursor);
switch (accessSpecifier)
{
case CX_CXXAccessSpecifier.CX_CXXPrivate: modifiers[parentUnit] = Modifiers.Private; break;
case CX_CXXAccessSpecifier.CX_CXXProtected: modifiers[parentUnit] = Modifiers.Protected; break;
case CX_CXXAccessSpecifier.CX_CXXPublic: modifiers[parentUnit] = Modifiers.Public; break;
}
return CXChildVisitResult.CXChildVisit_Continue;
}
private CXChildVisitResult VisitEnumConstant(CXCursor cursor, CXCursor parent, IntPtr data)
{
Unit unitParent = units[parent];
string unitName = clang.getCString(clang.getCursorSpelling(cursor));
CppField unit = new CppField(unitParent, unitName);
units.Add(cursor, unit);
if (unitParent is CppType)
(unitParent as CppType).fields.Add(unit);
return CXChildVisitResult.CXChildVisit_Continue;
}
private CXChildVisitResult VisitField(CXCursor cursor, CXCursor parent, IntPtr data)
{
Unit unitParent = units[parent];
string unitName = clang.getCString(clang.getCursorSpelling(cursor));
CppField unit = new CppField(unitParent, unitName);
CXType type = clang.getCursorType(cursor);
uint isVolatile = clang.isVolatileQualifiedType(type); // property = const volatile
uint isConst = clang.isConstQualifiedType(type);
if (isVolatile > 0 && isConst > 0)
{
properties.Add(unit);
if (unitParent is Type)
{
unit.getAccessor = (unitParent as Type).Methods.FirstOrDefault(m => m.Name == "Get" + unit.Name);
unit.setAccessor = (unitParent as Type).Methods.FirstOrDefault(m => m.Name == "Set" + unit.Name);
}
}
unit.type = FromCXType(type);
CXCursor parentTypeCursor = units.First(u => u.Value == unitParent).Key;
CXType parentType = clang.getCursorType(parentTypeCursor);
unit.offset = clang.Type_getOffsetOf(parentType, unitName);
if (unitParent is Type && modifiers.ContainsKey(unitParent as Type))
unit.modifiers = modifiers[unitParent as Type];
if (clang.CXXMethod_isStatic(cursor) > 0) // FIXME ?
unit.modifiers |= Modifiers.Static;
if (!units.ContainsKey(cursor))
units.Add(cursor, unit);
if (unitParent is CppType)
(unitParent as CppType).fields.Add(unit);
return CXChildVisitResult.CXChildVisit_Recurse;
}
private CXChildVisitResult VisitMethod(CXCursor cursor, CXCursor parent, IntPtr data)
{
Unit unitParent = units[parent];
string unitName = clang.getCString(clang.getCursorSpelling(cursor));
CXCursorKind unitKind = clang.getCursorKind(cursor);
CppMethod unit;
if (unitKind == CXCursorKind.CXCursor_Constructor && unitParent is CppType) unit = new CppConstructor(unitParent as CppType);
else if (unitKind == CXCursorKind.CXCursor_Destructor && unitParent is CppType) unit = new CppDestructor(unitParent as CppType);
else unit = new CppMethod(unitParent, unitName);
// Find modifiers
if (unitParent is Type && modifiers.ContainsKey(unitParent as Type))
unit.modifiers = modifiers[unitParent as Type];
if (clang.CXXMethod_isStatic(cursor) > 0)
unit.modifiers |= Modifiers.Static;
// Find result type
if (unitKind != CXCursorKind.CXCursor_Constructor && unitKind != CXCursorKind.CXCursor_Destructor)
{
CXType result = clang.getCursorResultType(cursor);
unit.result = FromCXType(result, GetAllTemplates(unitParent).Concat(new[] { unitParent as Type }));
}
// Merge with properties
/*if (unitName.StartsWith("Get") || unitName.StartsWith("Set"))
{
CppField property = properties.FirstOrDefault(p => p.Name == unitName.Substring(3) && p.Parent == unitParent) as CppField;
if (property != null)
{
if (unitName.StartsWith("Get"))
property.getAccessor = unit;
else
property.setAccessor = unit;
}
}*/
// Parse templates
int startPosition = unitName.IndexOf('<');
int stopPosition = startPosition == -1 ? -1 : unitName.IndexOf('>', startPosition);
if (startPosition >= 0 && stopPosition >= 0)
{
string[] typeStrings = unitName.Substring(startPosition, stopPosition - startPosition).Split(',').Select(t => t.Trim()).ToArray();
foreach (string typeString in typeStrings)
unit.templates.Add(CppType.GetReference(typeString));
if (unitParent is Type)
{
foreach (Type type in (unitParent as Type).Templates)
unit.templates.RemoveAll(t => t.Equals(type));
}
}
units.Add(cursor, unit);
if (unitParent is CppType)
(unitParent as CppType).methods.Add(unit);
return CXChildVisitResult.CXChildVisit_Recurse;
}
private CXChildVisitResult VisitTemplateParameter(CXCursor cursor, CXCursor parent, IntPtr data)
{
Unit unit = units[parent];
string name = clang.getCString(clang.getCursorSpelling(cursor));
if (unit is CppType)
(unit as CppType).templates.Add(new Type.Template(name));
else if (unit is CppMethod)
(unit as CppMethod).templates.Add(new Type.Template(name));
return CXChildVisitResult.CXChildVisit_Continue;
}
private CXChildVisitResult VisitMethodParameter(CXCursor cursor, CXCursor parent, IntPtr data)
{
CppMethod method = units[parent] as CppMethod;
if (method == null)
return CXChildVisitResult.CXChildVisit_Continue;
string name = clang.getCString(clang.getCursorSpelling(cursor));
Type type = FromCXType(clang.getCursorType(cursor), method.Templates.Concat(new[] { method.Parent as Type }));
method.parameters.Add(name, type);
return CXChildVisitResult.CXChildVisit_Continue;
}
private Type FromCXType(CXType type, IEnumerable<Type> hintTypes = null)
{
Type typeResult = null;
switch (type.kind)
{
case CXTypeKind.CXType_DependentSizedArray:
case CXTypeKind.CXType_ConstantArray:
typeResult = new Type.Pointer(FromCXType(clang.getArrayElementType(type), hintTypes));
break;
case CXTypeKind.CXType_MemberPointer:
case CXTypeKind.CXType_Pointer:
typeResult = new Type.Pointer(FromCXType(clang.getPointeeType(type), hintTypes));
break;
case CXTypeKind.CXType_LValueReference:
case CXTypeKind.CXType_RValueReference:
typeResult = new Type.Reference(FromCXType(clang.getPointeeType(type), hintTypes));
break;
case CXTypeKind.CXType_FirstBuiltin: return Units.Types.Void;
case CXTypeKind.CXType_Bool: return Units.Types.Bool;
case CXTypeKind.CXType_SChar: return Units.Types.S8;
case CXTypeKind.CXType_Char_S: return Units.Types.S8;
case CXTypeKind.CXType_UChar: return Units.Types.U8;
case CXTypeKind.CXType_Char_U: return Units.Types.U8;
case CXTypeKind.CXType_Short: return Units.Types.S16;
case CXTypeKind.CXType_UShort: return Units.Types.U16;
case CXTypeKind.CXType_Int: return Units.Types.S32;
case CXTypeKind.CXType_UInt: return Units.Types.U32;
case CXTypeKind.CXType_LongLong: return Units.Types.S64;
case CXTypeKind.CXType_ULongLong: return Units.Types.U64;
case CXTypeKind.CXType_Float: return Units.Types.Single;
case CXTypeKind.CXType_Double: return Units.Types.Double;
case CXTypeKind.CXType_Unexposed:
{
string name = clang.getCString(clang.getTypeSpelling(type)).Replace("...", "").Replace("const ", "").Replace("volatile ", "");
typeResult = hintTypes?.FirstOrDefault(t => t?.Name == name) ?? CppType.GetReference(name, hintTypes);
break;
}
case CXTypeKind.CXType_Record:
{
string name = clang.getCString(clang.getTypeSpelling(type)).Replace("...", "").Replace("const ", "").Replace("volatile ", "");
typeResult = hintTypes?.FirstOrDefault(t => t?.Name == name) ?? CppType.GetReference(name, hintTypes);
break;
}
case CXTypeKind.CXType_Enum:
case CXTypeKind.CXType_Typedef:
{
CXCursor cursor = clang.getTypeDeclaration(type);
Unit resolvedType;
typeResult = units.TryGetValue(cursor, out resolvedType) ? resolvedType as Type : null;
break;
}
}
int templateCount = clang.Type_getNumTemplateArguments(type);
if (typeResult != null && templateCount > 0 && !typeResult.Templates.Any() && typeResult is CppType)
{
for (uint i = 0; i < templateCount; i++)
{
Type templateType = FromCXType(clang.Type_getTemplateArgumentAsType(type, i), hintTypes);
if (templateType != null)
(typeResult as CppType).templates.Add(templateType);
}
}
return typeResult;
}
private IEnumerable<Type> GetAllTemplates(Unit unit)
{
if (unit is Type)
return (unit as Type).Templates.Concat(GetAllTemplates(unit.Parent));
return Enumerable.Empty<Type>();
}
}
} | 35.820106 | 146 | 0.647267 | [
"MIT"
] | jbatonnet/System | Source/[Tools]/Tools.Parser/Parsers/Cpp/Clang/ClangParser.cs | 20,312 | C# |
using System;
using System.Reflection;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using BepInEx.Logging;
using HarmonyLib;
using Pathfinder.Util.XML;
namespace Pathfinder.Util
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public class XMLStorageAttribute : Attribute
{
private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public;
public static string WriteToXml(object obj)
{
var thisType = obj.GetType();
var attribType = typeof(XMLStorageAttribute);
var builder = new StringBuilder();
builder.Append($"<{thisType.Name} ");
foreach (var fieldInfo in thisType.GetFields(Flags))
{
if (fieldInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
if (fieldInfo.IsStatic || fieldInfo.FieldType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid field for XML storage: {fieldInfo.Name}");
continue;
}
string val = (string)fieldInfo.GetValue(obj);
builder.Append($"{fieldInfo.Name}=\"{val}\"");
}
foreach (var propertyInfo in thisType.GetProperties(Flags))
{
if (propertyInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
var getMethod = propertyInfo.GetGetMethod();
var setMethod = propertyInfo.GetSetMethod();
if (getMethod.IsStatic || setMethod.IsStatic || propertyInfo.PropertyType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid property for XML storage: {propertyInfo.Name}");
continue;
}
string val = (string)getMethod.Invoke(obj, null);
builder.Append($"{propertyInfo.Name}=\"{val}\"");
}
builder.Append("/>");
return builder.ToString();
}
public static XElement WriteToElement(object obj)
{
var thisType = obj.GetType();
var attribType = typeof(XMLStorageAttribute);
var element = new XElement(thisType.Name);
foreach (var fieldInfo in thisType.GetFields(Flags))
{
if (fieldInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
if (fieldInfo.IsStatic || fieldInfo.FieldType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid field for XML storage: {fieldInfo.Name}");
continue;
}
string val = (string)fieldInfo.GetValue(obj);
element.SetAttributeValue(fieldInfo.Name, val);
}
foreach (var propertyInfo in thisType.GetProperties(Flags))
{
if (propertyInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
var getMethod = propertyInfo.GetGetMethod();
var setMethod = propertyInfo.GetSetMethod();
if (getMethod.IsStatic || setMethod.IsStatic || propertyInfo.PropertyType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid property for XML storage: {propertyInfo.Name}");
continue;
}
string val = (string)getMethod.Invoke(obj, null);
element.SetAttributeValue(propertyInfo.Name, val);
}
return element;
}
public static void ReadFromXml(XmlReader reader, object obj)
{
var thisType = obj.GetType();
var attribType = typeof(XMLStorageAttribute);
foreach (var fieldInfo in thisType.GetFields(Flags))
{
if (fieldInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
if (fieldInfo.FieldType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid field for XML storage: {fieldInfo.Name}");
continue;
}
string defaultValue = (string)fieldInfo.GetValue(obj);
string val = reader.GetAttribute(fieldInfo.Name);
if (val == null) {
val = defaultValue;
}
fieldInfo.SetValue(obj, val);
}
foreach (var propertyInfo in thisType.GetProperties(Flags))
{
if (propertyInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
var getMethod = propertyInfo.GetGetMethod();
var setMethod = propertyInfo.GetSetMethod();
if (propertyInfo.PropertyType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid property for XML storage: {propertyInfo.Name}");
continue;
}
string defaultValue = (string)propertyInfo.GetValue(obj, null);
string val = reader.GetAttribute(propertyInfo.Name);
if (val == null) {
val = defaultValue;
}
setMethod.Invoke(obj, new object[] { val });
}
}
public static void ReadFromElement(ElementInfo info, object obj)
{
var thisType = obj.GetType();
var attribType = typeof(XMLStorageAttribute);
foreach (var fieldInfo in thisType.GetFields(Flags))
{
if (fieldInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
if (fieldInfo.FieldType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid field for XML storage: {fieldInfo.Name}");
continue;
}
fieldInfo.SetValue(obj, info.Attributes.GetString(fieldInfo.Name, (string)fieldInfo.GetValue(obj)));
}
foreach (var propertyInfo in thisType.GetProperties(Flags))
{
if (propertyInfo.GetCustomAttributes(attribType, false).Length < 1)
continue;
var getMethod = propertyInfo.GetGetMethod();
var setMethod = propertyInfo.GetSetMethod();
if (propertyInfo.PropertyType != typeof(string))
{
Logger.Log(LogLevel.Error, $"Invalid property for XML storage: {propertyInfo.Name}");
continue;
}
setMethod.Invoke(obj, new object[] { info.Attributes.GetString(propertyInfo.Name, (string)propertyInfo.GetValue(obj, null)) });
}
}
}
}
| 38.693989 | 143 | 0.530716 | [
"MIT"
] | MaowImpl/Hacknet-Pathfinder | PathfinderAPI/Util/XMLStorageAttribute.cs | 7,083 | C# |
//
// Mono.Cxxi.Abi.MsvcAbi.cs: An implementation of the Microsoft Visual C++ ABI
//
// Author:
// Alexander Corrado (alexander.corrado@gmail.com)
// Andreia Gaita (shana@spoiledcat.net)
//
// Copyright (C) 2010-2011 Alexander Corrado
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Mono.Cxxi;
using Mono.Cxxi.Util;
namespace Mono.Cxxi.Abi {
// FIXME: No 64-bit support
public class MsvcAbi : CppAbi {
public static readonly MsvcAbi Instance = new MsvcAbi ();
private MsvcAbi ()
{
}
public override CallingConvention? GetCallingConvention (MethodInfo methodInfo)
{
// FIXME: Varargs methods ... ?
if (IsStatic (methodInfo))
return CallingConvention.Cdecl;
else
return CallingConvention.ThisCall;
}
protected override string GetMangledMethodName (CppTypeInfo typeInfo, MethodInfo methodInfo)
{
var methodName = methodInfo.Name;
var type = typeInfo.GetMangleType ();
var className = type.ElementTypeName;
MethodType methodType = GetMethodType (typeInfo, methodInfo);
ParameterInfo [] parameters = methodInfo.GetParameters ();
StringBuilder nm = new StringBuilder ("?", 30);
if (methodType == MethodType.NativeCtor)
nm.Append ("?0");
else if (methodType == MethodType.NativeDtor)
nm.Append ("?1");
else
nm.Append (methodName).Append ('@');
// FIXME: This has to include not only the name of the immediate containing class,
// but also all names of containing classes and namespaces up the hierarchy.
nm.Append (className).Append ("@@");
// function modifiers are a matrix of consecutive uppercase letters
// depending on access type and virtual (far)/static (far)/far modifiers
// first, access type
char funcModifier = 'Q'; // (public)
if (IsProtected (methodInfo))
funcModifier = 'I';
else if (IsPrivate (methodInfo)) // (probably don't need this)
funcModifier = 'A';
// now, offset based on other modifiers
if (IsStatic (methodInfo))
funcModifier += (char)2;
else if (IsVirtual (methodInfo))
funcModifier += (char)4;
nm.Append (funcModifier);
// FIXME: deal with other storage classes for "this" i.e. the "volatile" in -> int foo () volatile;
if (!IsStatic (methodInfo)) {
if (IsConst (methodInfo))
nm.Append ('B');
else
nm.Append ('A');
}
switch (GetCallingConvention (methodInfo)) {
case CallingConvention.Cdecl:
nm.Append ('A');
break;
case CallingConvention.ThisCall:
nm.Append ('E');
break;
case CallingConvention.StdCall:
nm.Append ('G');
break;
case CallingConvention.FastCall:
nm.Append ('I');
break;
}
// FIXME: handle const, volatile modifiers on return type
// FIXME: the manual says this is only omitted for simple types.. are we doing the right thing here?
CppType returnType = GetMangleType (methodInfo.ReturnTypeCustomAttributes, methodInfo.ReturnType);
if (returnType.ElementType == CppTypes.Class ||
returnType.ElementType == CppTypes.Struct ||
returnType.ElementType == CppTypes.Union)
nm.Append ("?A");
if (methodType == MethodType.NativeCtor || methodType == MethodType.NativeDtor)
nm.Append ('@');
else
nm.Append (GetTypeCode (returnType));
int argStart = (IsStatic (methodInfo)? 0 : 1);
if (parameters.Length == argStart) { // no args (other than C++ "this" object)
nm.Append ("XZ");
return nm.ToString ();
} else
for (int i = argStart; i < parameters.Length; i++)
nm.Append (GetTypeCode (GetMangleType (parameters [i], parameters [i].ParameterType)));
nm.Append ("@Z");
return nm.ToString ();
}
public virtual string GetTypeCode (CppType mangleType)
{
CppTypes element = mangleType.ElementType;
IEnumerable<CppModifiers> modifiers = mangleType.Modifiers;
StringBuilder code = new StringBuilder ();
var ptr = For.AnyInputIn (CppModifiers.Pointer);
var ptrRefOrArray = For.AnyInputIn (CppModifiers.Pointer, CppModifiers.Reference, CppModifiers.Array);
var modifierCode = modifiers.Reverse ().Transform (
Choose.TopOne (
For.AllInputsIn (CppModifiers.Const, CppModifiers.Volatile).InAnyOrder ().After (ptrRefOrArray).Emit ('D'),
For.AnyInputIn (CppModifiers.Const).After (ptrRefOrArray).Emit ('B'),
For.AnyInputIn (CppModifiers.Volatile).After (ptrRefOrArray).Emit ('C'),
For.AnyInput<CppModifiers> ().After (ptrRefOrArray).Emit ('A')
),
For.AnyInputIn (CppModifiers.Array).Emit ('Q'),
For.AnyInputIn (CppModifiers.Reference).Emit ('A'),
Choose.TopOne (
ptr.After ().AllInputsIn (CppModifiers.Const, CppModifiers.Volatile).InAnyOrder ().Emit ('S'),
ptr.After ().AnyInputIn (CppModifiers.Const).Emit ('Q'),
ptr.After ().AnyInputIn (CppModifiers.Volatile).Emit ('R'),
ptr.Emit ('P')
),
ptrRefOrArray.AtEnd ().Emit ('A')
);
code.Append (modifierCode.ToArray ());
switch (element) {
case CppTypes.Void:
code.Append ('X');
break;
case CppTypes.Int:
code.Append (modifiers.Transform (
For.AllInputsIn (CppModifiers.Unsigned, CppModifiers.Short).InAnyOrder ().Emit ('G')
).DefaultIfEmpty ('H').ToArray ());
break;
case CppTypes.Char:
code.Append ('D');
break;
case CppTypes.Class:
code.Append ('V');
code.Append(mangleType.ElementTypeName);
code.Append ("@@");
break;
case CppTypes.Struct:
code.Append ('U');
code.Append(mangleType.ElementTypeName);
code.Append ("@@");
break;
case CppTypes.Union:
code.Append ('T');
code.Append(mangleType.ElementTypeName);
code.Append ("@@");
break;
case CppTypes.Enum:
code.Append ("W4");
code.Append(mangleType.ElementTypeName);
code.Append ("@@");
break;
}
return code.ToString ();
}
}
}
| 32.081448 | 113 | 0.676728 | [
"MIT"
] | akash246/cxxi | src/Mono.Cxxi/Abi/Impl/MsvcAbi.cs | 7,090 | C# |
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace Essensoft.AspNetCore.Payment.Alipay.Response
{
/// <summary>
/// AlipayEcoMycarMaintainOrderCreateResponse.
/// </summary>
public class AlipayEcoMycarMaintainOrderCreateResponse : AlipayResponse
{
/// <summary>
/// 业务订单编号,规则28位;yyMMddHHmmss +  行业标识3位+模块标识2位 +uid(后六位) +序列值(5位)
/// </summary>
[JsonProperty("order_no")]
[XmlElement("order_no")]
public string OrderNo { get; set; }
}
}
| 28.789474 | 98 | 0.647166 | [
"MIT"
] | AkonCoder/Payment | src/Essensoft.AspNetCore.Payment.Alipay/Response/AlipayEcoMycarMaintainOrderCreateResponse.cs | 611 | C# |
namespace EventStore.Library.Models
{
public record EventData(string Id, string AggregateId, string EventName, string Data, string AssemblyQualifiedName);
}
| 32.4 | 120 | 0.802469 | [
"MIT"
] | beyondnetPeru/Beyondnet.Product.SkillMap | src/BuildingBlocks/EventStore/EventStore.Library/Models/EventData.cs | 164 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using HuaweiCloud.SDK.Core;
namespace HuaweiCloud.SDK.ImageSearch.V1.Model
{
/// <summary>
/// Response Object
/// </summary>
public class RunCheckPictureResponse : SdkResponse
{
/// <summary>
/// 调用成功时表示调用结果。 调用失败时无此字段。 - true表示图像索引库中存在查询的图片。 - false表示图像索引库中不存在查询的图片。
/// </summary>
[JsonProperty("exist", NullValueHandling = NullValueHandling.Ignore)]
public string Exist { get; set; }
/// <summary>
/// Get the string
/// </summary>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class RunCheckPictureResponse {\n");
sb.Append(" exist: ").Append(Exist).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
public override bool Equals(object input)
{
return this.Equals(input as RunCheckPictureResponse);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
public bool Equals(RunCheckPictureResponse input)
{
if (input == null)
return false;
return
(
this.Exist == input.Exist ||
(this.Exist != null &&
this.Exist.Equals(input.Exist))
);
}
/// <summary>
/// Get hash code
/// </summary>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.Exist != null)
hashCode = hashCode * 59 + this.Exist.GetHashCode();
return hashCode;
}
}
}
}
| 27.144737 | 87 | 0.516723 | [
"Apache-2.0"
] | cnblogs/huaweicloud-sdk-net-v3 | Services/ImageSearch/V1/Model/RunCheckPictureResponse.cs | 2,173 | C# |
namespace Gecko.WebIDL
{
using System;
internal class OES_texture_float_linear : WebIDLBase
{
public OES_texture_float_linear(nsIDOMWindow globalWindow, nsISupports thisObject) :
base(globalWindow, thisObject)
{
}
}
}
| 19.6 | 93 | 0.608844 | [
"MIT"
] | haga-rak/Freezer | Freezer/GeckoFX/__Core/WebIDL/Generated/OES_texture_float_linear.cs | 294 | C# |
#pragma checksum "/Users/satishpe/Projects/eks-demo/dotnetcore-eks-demo/dotnetcore-eks-demo/Pages/Error.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "cc695e7b6fc60e9a6fcc9e9cd75eefa24d7b3f98"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(dotnetcore_eks_demo.Pages.Pages_Error), @"mvc.1.0.razor-page", @"/Pages/Error.cshtml")]
namespace dotnetcore_eks_demo.Pages
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#nullable restore
#line 1 "/Users/satishpe/Projects/eks-demo/dotnetcore-eks-demo/dotnetcore-eks-demo/Pages/_ViewImports.cshtml"
using dotnetcore_eks_demo;
#line default
#line hidden
#nullable disable
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"cc695e7b6fc60e9a6fcc9e9cd75eefa24d7b3f98", @"/Pages/Error.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"70e56df9084c150d33d1010aa7a6a040b1cfa2b8", @"/Pages/_ViewImports.cshtml")]
public class Pages_Error : global::Microsoft.AspNetCore.Mvc.RazorPages.Page
{
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
#nullable restore
#line 3 "/Users/satishpe/Projects/eks-demo/dotnetcore-eks-demo/dotnetcore-eks-demo/Pages/Error.cshtml"
ViewData["Title"] = "Error";
#line default
#line hidden
#nullable disable
WriteLiteral("\n<h1 class=\"text-danger\">Error.</h1>\n<h2 class=\"text-danger\">An error occurred while processing your request.</h2>\n\n");
#nullable restore
#line 10 "/Users/satishpe/Projects/eks-demo/dotnetcore-eks-demo/dotnetcore-eks-demo/Pages/Error.cshtml"
if (Model.ShowRequestId)
{
#line default
#line hidden
#nullable disable
WriteLiteral(" <p>\n <strong>Request ID:</strong> <code>");
#nullable restore
#line 13 "/Users/satishpe/Projects/eks-demo/dotnetcore-eks-demo/dotnetcore-eks-demo/Pages/Error.cshtml"
Write(Model.RequestId);
#line default
#line hidden
#nullable disable
WriteLiteral("</code>\n </p>\n");
#nullable restore
#line 15 "/Users/satishpe/Projects/eks-demo/dotnetcore-eks-demo/dotnetcore-eks-demo/Pages/Error.cshtml"
}
#line default
#line hidden
#nullable disable
WriteLiteral(@"
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
");
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<ErrorModel> Html { get; private set; }
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<ErrorModel> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<ErrorModel>)PageContext?.ViewData;
public ErrorModel Model => ViewData.Model;
}
}
#pragma warning restore 1591
| 48.241758 | 204 | 0.749431 | [
"MIT"
] | pskseattle/dotnetcore-eks-demo | dotnetcore-eks-demo/obj/Debug/netcoreapp3.1/Razor/Pages/Error.cshtml.g.cs | 4,390 | C# |
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Atf.Gui")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Atf.Gui")]
[assembly: AssemblyCopyright("Copyright © 2014 Sony Computer Entertainment America LLC")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("57ff0dff-8400-4535-816c-57102704780a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 39.5 | 90 | 0.724332 | [
"Apache-2.0"
] | HaKDMoDz/ATF | Framework/Atf.Gui/Properties/AssemblyInfo.cs | 1,390 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using Topten.Sharp86;
namespace UnitTests
{
public class OpCodeTests80 : CPUUnitTests
{
[Fact]
public void Add_Eb_Ib()
{
MMU.WriteByte(0, 100, 40);
emit("add byte [100], 20");
run();
Assert.Equal(60, MMU.ReadByte(0, 100));
}
[Fact]
public void Or_Eb_Ib()
{
MMU.WriteByte(0, 100, 0x41);
emit("or byte [100], 21h");
run();
Assert.Equal(0x61, MMU.ReadByte(0, 100));
}
[Fact]
public void Adc_Eb_Ib()
{
MMU.WriteByte(0, 100, 40);
FlagC = true;
emit("adc byte [100], 20");
run();
Assert.Equal(61, MMU.ReadByte(0, 100));
}
[Fact]
public void Sbb_Eb_Ib()
{
MMU.WriteByte(0, 100, 40);
FlagC = true;
emit("sbb byte [100], 10");
run();
Assert.Equal(29, MMU.ReadByte(0, 100));
}
[Fact]
public void And_Eb_Ib()
{
MMU.WriteByte(0, 100, 0x60);
emit("and byte [100], 20h");
run();
Assert.Equal(0x20, MMU.ReadByte(0, 100));
}
[Fact]
public void Sub_Eb_Ib()
{
MMU.WriteByte(0, 100, 40);
FlagC = true;
emit("sub byte [100], 10");
run();
Assert.Equal(30, MMU.ReadByte(0, 100));
}
[Fact]
public void Xor_Eb_Ib()
{
MMU.WriteByte(0, 100, 0x60);
emit("xor byte [100], 0x20");
run();
Assert.Equal(0x40, MMU.ReadByte(0, 100));
}
[Fact]
public void Cmp_Eb_Ib()
{
MMU.WriteByte(0, 100, 40);
FlagC = true;
FlagZ = true;
emit("cmp byte [100], 10");
run();
Assert.Equal(40, MMU.ReadByte(0, 100));
Assert.False(FlagZ);
Assert.False(FlagC);
}
[Fact]
public void Add_Ev_Iv()
{
WriteWord(0, 100, 4000);
emit("add word [100], 2000");
run();
Assert.Equal(6000, ReadWord(0, 100));
}
[Fact]
public void Or_Ev_Iv()
{
WriteWord(0, 100, 0x4001);
emit("or word [100], 2001h");
run();
Assert.Equal(0x6001, ReadWord(0, 100));
}
[Fact]
public void Adc_Ev_Iv()
{
WriteWord(0, 100, 4000);
FlagC = true;
emit("adc word [100], 2000");
run();
Assert.Equal(6001, ReadWord(0, 100));
}
[Fact]
public void Sbb_Ev_Iv()
{
WriteWord(0, 100, 4000);
FlagC = true;
emit("sbb word [100], 1000");
run();
Assert.Equal(2999, ReadWord(0, 100));
}
[Fact]
public void And_Ev_Iv()
{
WriteWord(0, 100, 0x6000);
emit("and word [100], 2000h");
run();
Assert.Equal(0x2000, ReadWord(0, 100));
}
[Fact]
public void Sub_Ev_Iv()
{
WriteWord(0, 100, 4000);
FlagC = true;
emit("sub word [100], 1000");
run();
Assert.Equal(3000, ReadWord(0, 100));
}
[Fact]
public void Xor_Ev_Iv()
{
WriteWord(0, 100, 0x6000);
emit("xor word [100], 2000h");
run();
Assert.Equal(0x4000, ReadWord(0, 100));
}
[Fact]
public void Cmp_Ev_Iv()
{
WriteWord(0, 100, 4000);
FlagC = true;
FlagZ = true;
emit("cmp word [100], 1000");
run();
Assert.Equal(4000, ReadWord(0, 100));
Assert.False(FlagZ);
Assert.False(FlagC);
}
[Fact]
public void Add_Ev_Ib()
{
WriteWord(0, 100, 4000);
emit("add word [100], byte 0xFF");
run();
Assert.Equal(3999, ReadWord(0, 100));
}
[Fact]
public void Or_Ev_Ib()
{
WriteWord(0, 100, 0x4001);
emit("or word [100], byte 0xFE");
run();
Assert.Equal(0xFFFF, ReadWord(0, 100));
}
[Fact]
public void Adc_Ev_Ib()
{
WriteWord(0, 100, 4000);
FlagC = true;
emit("adc word [100], byte 0xFE");
run();
Assert.Equal(3999, ReadWord(0, 100));
}
[Fact]
public void Sbb_Ev_Ib()
{
WriteWord(0, 100, 4000);
FlagC = true;
emit("sbb word [100], byte 0xFE");
run();
Assert.Equal(4001, ReadWord(0, 100));
}
[Fact]
public void And_Ev_Ib()
{
WriteWord(0, 100, 0x6000);
emit("and word [100], byte 0xFE");
run();
Assert.Equal(0x6000, ReadWord(0, 100));
}
[Fact]
public void Sub_Ev_Ib()
{
WriteWord(0, 100, 4000);
FlagC = true;
emit("sub word [100], byte 0xFF");
run();
Assert.Equal(4001, ReadWord(0, 100));
}
[Fact]
public void Xor_Ev_Ib()
{
WriteWord(0, 100, 0x6000);
emit("xor word [100], byte 0xFF");
run();
Assert.Equal(0x9FFF, ReadWord(0, 100));
}
[Fact]
public void Cmp_Ev_Ib()
{
WriteWord(0, 100, 4000);
FlagC = true;
FlagZ = true;
emit("cmp word [100], byte 0xFE");
run();
Assert.Equal(4000, ReadWord(0, 100));
Assert.False(FlagZ);
Assert.True(FlagC);
}
[Fact]
public void Test_Eb_Gb()
{
MMU.WriteByte(0, 100, 0x60);
al = 0x20;
emit("test byte [100], al");
run();
Assert.Equal(0x60, MMU.ReadByte(0, 100));
Assert.False(FlagZ);
}
[Fact]
public void Test_Ev_Gv()
{
WriteWord(0, 100, 0x6000);
ax = 0x2000;
emit("test word [100], ax");
run();
Assert.Equal(0x6000, ReadWord(0, 100));
Assert.False(FlagZ);
}
[Fact]
public void Xchg_Eb_Gb()
{
MMU.WriteByte(0, 100, 0x60);
al = 0x20;
emit("xchg byte [100], al");
run();
Assert.Equal(0x20, MMU.ReadByte(0, 100));
Assert.Equal(0x60, al);
}
[Fact]
public void Xchg_Ev_Gv()
{
WriteWord(0, 100, 0x6000);
ax = 0x2000;
emit("xchg word [100], ax");
run();
Assert.Equal(0x2000, ReadWord(0, 100));
Assert.Equal(0x6000, ax);
}
}
}
| 23.542484 | 53 | 0.420738 | [
"Apache-2.0"
] | Zapeth/Sharp86 | UnitTests/OpCodeTests80.cs | 7,206 | C# |
/* Yet Another Forum.NET
* Copyright (C) 2003-2005 Bjørnar Henden
* Copyright (C) 2006-2013 Jaben Cargman
* Copyright (C) 2014-2021 Ingo Herbote
* https://www.yetanotherforum.net/
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
namespace YAF.Controls
{
#region Using
using System;
using System.Linq;
using System.Web.UI.WebControls;
using YAF.Core.BaseControls;
using YAF.Core.Extensions;
using YAF.Core.Model;
using YAF.Core.Services;
using YAF.Core.Utilities;
using YAF.Types;
using YAF.Types.Constants;
using YAF.Types.Extensions;
using YAF.Types.Interfaces;
using YAF.Types.Models;
#endregion
/// <summary>
/// The AlbumList control.
/// </summary>
public partial class AlbumList : BaseUserControl
{
#region Properties
/// <summary>
/// Gets or sets the User ID.
/// </summary>
public User User { get; set; }
#endregion
#region Methods
/// <summary>
/// redirects to the add new album page.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void AddAlbum_Click([NotNull] object sender, [NotNull] EventArgs e)
{
this.Get<LinkBuilder>().Redirect(ForumPages.EditAlbumImages, "a=new");
}
/// <summary>
/// The item command method for albums repeater. Redirects to the album page.
/// </summary>
/// <param name="source">The source of the event.</param>
/// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterCommandEventArgs"/> instance containing the event data.</param>
protected void Albums_ItemCommand([NotNull] object source, [NotNull] RepeaterCommandEventArgs e)
{
this.Get<LinkBuilder>().Redirect(ForumPages.EditAlbumImages, "a={0}", e.CommandArgument);
}
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
protected override void OnPreRender([NotNull] EventArgs e)
{
if (this.User.ID == this.PageContext.PageUserID)
{
// Register Js Blocks.
this.PageContext.PageElements.RegisterJsBlockStartup(
"AlbumEventsJs",
JavaScriptBlocks.AlbumEventsJs(
this.Get<ILocalization>().GetText("ALBUM_CHANGE_TITLE").ToJsString(),
this.Get<ILocalization>().GetText("ALBUM_IMAGE_CHANGE_CAPTION").ToJsString()));
this.PageContext.PageElements.RegisterJsBlockStartup(
"AlbumCallbackSuccessJS", JavaScriptBlocks.AlbumCallbackSuccessJs);
}
base.OnPreRender(e);
}
/// <summary>
/// Called when the page loads
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
{
if (this.IsPostBack)
{
return;
}
this.Header.Param0 = this.HtmlEncode(this.User.DisplayOrUserName());
this.BindData();
var userAlbum = (int)this.GetRepository<User>().MaxAlbumData(
this.PageContext.PageUserID,
this.PageContext.PageBoardID).UserAlbum;
// Show Albums Max Info
if (this.User.ID == this.PageContext.PageUserID)
{
this.albumsInfo.Text = this.Get<ILocalization>().GetTextFormatted(
"ALBUMS_INFO", this.PageContext.NumAlbums, userAlbum);
if (userAlbum > this.PageContext.NumAlbums)
{
this.AddAlbum.Visible = true;
}
this.albumsInfo.Text = userAlbum > 0
? this.Get<ILocalization>().GetTextFormatted(
"ALBUMS_INFO", this.PageContext.NumAlbums, userAlbum)
: this.Get<ILocalization>().GetText("ALBUMS_NOTALLOWED");
this.albumsInfo.Visible = true;
}
if (!this.AddAlbum.Visible)
{
return;
}
this.AddAlbum.TextLocalizedPage = "BUTTON";
this.AddAlbum.TextLocalizedTag = "BUTTON_ADDALBUM";
}
/// <summary>
/// The pager_ page change.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Pager_PageChange([NotNull] object sender, [NotNull] EventArgs e)
{
this.BindData();
}
/// <summary>
/// Binds the album list data.
/// </summary>
private void BindData()
{
this.PagerTop.PageSize = this.PageContext.BoardSettings.AlbumsPerPage;
// set the Data table
var albums = this.GetRepository<UserAlbum>().ListByUserPaged(this.User.ID, this.PagerTop.CurrentPageIndex, this.PagerTop.PageSize);
if (albums == null || !albums.Any())
{
return;
}
this.PagerTop.Count = this.GetRepository<UserAlbum>().ListByUser(this.User.ID).Count;
this.Albums.DataSource = albums;
this.DataBind();
}
#endregion
}
} | 37.229508 | 144 | 0.572435 | [
"Apache-2.0"
] | 10by10pixel/YAFNET | yafsrc/YetAnotherForum.NET/Controls/AlbumList.ascx.cs | 6,632 | C# |
using System;
using Xunit;
namespace Rhino.Mocks.Tests.FieldsProblem
{
public class FieldProblem_Sander
{
[Fact]
public void CanUseOutIntPtr()
{
IFooWithOutIntPtr mock = MockRepository.GenerateStrictMock<IFooWithOutIntPtr>();
IntPtr parameter;
mock.Expect(x => x.GetBar(out parameter)).IgnoreArguments().Return(5).OutRef(new IntPtr(3));
Assert.Equal(5, mock.GetBar(out parameter));
Assert.Equal(new IntPtr(3), parameter);
mock.VerifyAllExpectations();
}
}
public interface IFooWithOutIntPtr
{
int GetBar(out IntPtr parameter);
}
} | 28.791667 | 105 | 0.60492 | [
"BSD-3-Clause"
] | alaendle/rhino-mocks | Rhino.Mocks.Tests/FieldsProblem/FieldProblem_Sander.cs | 691 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("01. Exercises")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("01. Exercises")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("69ff7b7c-d576-4636-9fb9-b7d884eaa1f1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.810811 | 84 | 0.742673 | [
"MIT"
] | plamenrusanov/Programming-Fundamentals | Objects and Simple Classes - Exercises/01. Exercises/Properties/AssemblyInfo.cs | 1,402 | C# |
public enum AddonHost
{
Camera = 1,
ActivePlane = 2,
GameScene = 3,
Persistant = 4
} | 14.428571 | 22 | 0.584158 | [
"MIT"
] | CarnationRED/UnityRuntimeInspector_SimplePlanes | RuntimeInspector_Main/AddonHost.cs | 103 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Maticsoft.Web.m_weixin.message_model.req
{
public class ReqVoiceMessage : ReqBaseMessage
{
public String MediaId { get; set; }
public String Format { get; set; }
}
} | 22.307692 | 50 | 0.7 | [
"Unlicense"
] | nature-track/wenCollege-CSharp | Web/m_weixin/message_model/req/ReqVoiceMessage.cs | 292 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Conductor : MonoBehaviour
{
[SerializeField] int _ticksPerEighth = 10;
[SerializeField] float _audioLatency;
[SerializeField] AudioSource _hatSound;
[SerializeField] AudioSource _openHatSound;
[SerializeField] AudioSource _snareSound;
[SerializeField] Basketball _basketball;
int _ticks;
void FixedUpdate ()
{
_ticks++;
if (_ticks % (8 * _ticksPerEighth) == 0) {
note();
}
else if (_ticks % (2 * _ticksPerEighth) == 0) {
quarter();
}
else if (_ticks % _ticksPerEighth == 0) {
eighth();
}
}
void eighth()
{
switch (_basketball.state) {
case Basketball.State.Bouncing:
break;
case Basketball.State.Grabbed:
_hatSound.Play();
break;
case Basketball.State.Tossed:
break;
}
}
void quarter()
{
switch (_basketball.state) {
case Basketball.State.Bouncing:
_hatSound.Play();
break;
case Basketball.State.Grabbed:
_hatSound.Play();
break;
case Basketball.State.Tossed:
_hatSound.Play();
break;
}
}
void note()
{
switch (_basketball.state) {
case Basketball.State.Bouncing:
_hatSound.Play();
_snareSound.Play();
break;
case Basketball.State.Grabbed:
_hatSound.Play();
break;
case Basketball.State.Tossed:
_openHatSound.Play();
break;
}
}
void Update()
{
var subTick = (Time.time - Time.fixedTime) / Time.fixedDeltaTime;
var timeInBounce = ((float)_ticks + subTick) / _ticksPerEighth / 8.0f;
_basketball.UpdateForTime(timeInBounce + 0.01f);
}
}
| 24.927711 | 79 | 0.518125 | [
"MIT"
] | jaburns/vrtests | Assets/BeatsketBall/Conductor.cs | 2,071 | C# |
using System.Collections.Generic;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace OwinFramework.Pages.Core.Debug
{
/// <summary>
/// Debug information about a layout
/// </summary>
public class DebugRenderContext : DebugInfo
{
/// <summary>
/// Default public constructor
/// </summary>
public DebugRenderContext()
{
Type = "Render context";
}
/// <summary>
/// Debug information about the data that will be
/// used for data binding during this rendering operation
/// </summary>
[JsonProperty, XmlIgnore]
public IDictionary<int, DebugDataContext> Data { get; set; }
/// <summary>
/// Indicates of this debug info is worth displaying
/// </summary>
public override bool HasData()
{
return true;
}
}
}
| 25.444444 | 68 | 0.573144 | [
"Apache-2.0"
] | forki/OwinFramework.Pages | OwinFramework.Pages.Core/Debug/DebugRenderContext.cs | 918 | C# |
using Newtonsoft.Json;
using Seemon.Vault.Helpers;
namespace Seemon.Vault.Models
{
public class Settings : BindableBase
{
[JsonConstructor]
public Settings()
{
Application = new ApplicationSettings();
System = new SystemSettings();
Clipboard = new ClipboardSettings();
PasswordGenerator = new PasswordGeneratorSettings();
Git = new GitSettings();
Updates = new UpdateSettings();
Programs = new ProgramPathSettings();
Profiles = new ItemObservableCollection<Profile>();
}
[JsonProperty("application")]
public ApplicationSettings Application { get; set; }
[JsonProperty("system")]
public SystemSettings System { get; set; }
[JsonProperty("clipboard")]
public ClipboardSettings Clipboard { get; set; }
[JsonProperty("passwordGenerator")]
public PasswordGeneratorSettings PasswordGenerator { get; set; }
[JsonProperty("git")]
public GitSettings Git { get; set; }
[JsonProperty("updates")]
public UpdateSettings Updates { get; set; }
[JsonProperty("programs")]
public ProgramPathSettings Programs { get; set; }
[JsonProperty("profiles")]
public ItemObservableCollection<Profile> Profiles { get; set; }
}
}
| 29.978261 | 72 | 0.617114 | [
"MIT"
] | fossabot/Vault-3 | src/Models/Settings.cs | 1,381 | C# |
//-----------------------------------------------------------------------------
// FILE: Test_CsvWriter.cs
// CONTRIBUTOR: Jeff Lill
// COPYRIGHT: Copyright (c) 2005-2021 by neonFORGE LLC. All rights reserved.
//
// 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
//
// http://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.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Neon.Csv;
using Neon.Xunit;
using Xunit;
namespace TestCommon
{
[Trait(TestTrait.Category, TestArea.NeonCommon)]
public class Test_CsvWriter
{
[Fact]
public void CsvWriter_Basic()
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
CsvWriter writer = new CsvWriter(sw);
writer.WriteLine(10, 20, 11.5, "Hello", "Hello,World", "Hello \"Cruel\" World", null);
writer.WriteLine("End");
writer.Close();
Assert.Equal(
@"10,20,11.5,Hello,""Hello,World"",""Hello """"Cruel"""" World"",
End
", sb.ToString());
}
}
}
| 29.673077 | 98 | 0.626701 | [
"Apache-2.0"
] | nforgeio/neonKUBE | Test/Test.Neon.Common/Csv/Test_CsvWriter.cs | 1,545 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.SumoLogic.Outputs
{
[OutputType]
public sealed class DashboardPanelSumoSearchPanelQueryMetricsQueryData
{
public readonly string? AggregationType;
public readonly ImmutableArray<Outputs.DashboardPanelSumoSearchPanelQueryMetricsQueryDataFilter> Filters;
public readonly string? GroupBy;
public readonly string Metric;
public readonly ImmutableArray<Outputs.DashboardPanelSumoSearchPanelQueryMetricsQueryDataOperator> Operators;
[OutputConstructor]
private DashboardPanelSumoSearchPanelQueryMetricsQueryData(
string? aggregationType,
ImmutableArray<Outputs.DashboardPanelSumoSearchPanelQueryMetricsQueryDataFilter> filters,
string? groupBy,
string metric,
ImmutableArray<Outputs.DashboardPanelSumoSearchPanelQueryMetricsQueryDataOperator> operators)
{
AggregationType = aggregationType;
Filters = filters;
GroupBy = groupBy;
Metric = metric;
Operators = operators;
}
}
}
| 33.690476 | 117 | 0.715901 | [
"ECL-2.0",
"Apache-2.0"
] | pulumi/pulumi-sumologic | sdk/dotnet/Outputs/DashboardPanelSumoSearchPanelQueryMetricsQueryData.cs | 1,415 | C# |
// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Gov.Jag.PillPressRegistry.Interfaces
{
using Microsoft.Rest;
using Models;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Locationincidentequipmentlocation operations.
/// </summary>
public partial interface ILocationincidentequipmentlocation
{
/// <summary>
/// Get bcgov_location_incident_EquipmentLocation from bcgov_locations
/// </summary>
/// <param name='bcgovLocationid'>
/// key: bcgov_locationid of bcgov_location
/// </param>
/// <param name='top'>
/// </param>
/// <param name='skip'>
/// </param>
/// <param name='search'>
/// </param>
/// <param name='filter'>
/// </param>
/// <param name='count'>
/// </param>
/// <param name='orderby'>
/// Order items by property values
/// </param>
/// <param name='select'>
/// Select properties to be returned
/// </param>
/// <param name='expand'>
/// Expand related entities
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.HttpOperationException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<HttpOperationResponse<MicrosoftDynamicsCRMincidentCollection>> GetWithHttpMessagesAsync(string bcgovLocationid, int? top = default(int?), int? skip = default(int?), string search = default(string), string filter = default(string), bool? count = default(bool?), IList<string> orderby = default(IList<string>), IList<string> select = default(IList<string>), IList<string> expand = default(IList<string>), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Get bcgov_location_incident_EquipmentLocation from bcgov_locations
/// </summary>
/// <param name='bcgovLocationid'>
/// key: bcgov_locationid of bcgov_location
/// </param>
/// <param name='incidentid'>
/// key: incidentid of incident
/// </param>
/// <param name='select'>
/// Select properties to be returned
/// </param>
/// <param name='expand'>
/// Expand related entities
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.HttpOperationException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<HttpOperationResponse<MicrosoftDynamicsCRMincident>> EquipmentLocationByKeyWithHttpMessagesAsync(string bcgovLocationid, string incidentid, IList<string> select = default(IList<string>), IList<string> expand = default(IList<string>), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
| 43.989474 | 537 | 0.620962 | [
"Apache-2.0"
] | GeorgeWalker/jag-pill-press-registry | pill-press-interfaces/Dynamics-Autorest/ILocationincidentequipmentlocation.cs | 4,179 | C# |
using System.Collections.Generic;
using Blocknet.Lib.CoinParameters.Blocknet;
using Blocknet.Lib.Services.Coins.Base;
using Blocknet.Lib.Services.Coins.Blocknet;
using Blocknet.Lib.Services.Coins.Blocknet.Xrouter;
using Blocknet.Lib.Services.Coins.Blocknet.Xrouter.BitcoinBased;
using Xrouter.Service.Explorer.BitcoinLib.Services.Coins.Blocknet.XRouter;
public interface IXCloudService : ICoinService, IBlocknetConstants{
ServiceResponse xrService(string service, object[] parameters);
}
| 41.083333 | 74 | 0.839757 | [
"MIT"
] | XRouter-Service-Explorer/Blocknet.Lib | Services/Coins/Blocknet/IXCloudService.cs | 493 | C# |
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.ComponentModel;
using Microsoft.Build.Framework.XamlTypes;
using Microsoft.VisualStudio.ProjectSystem.Debug;
namespace Microsoft.VisualStudio.ProjectSystem.Properties
{
/// <summary>
/// <para>
/// Reads and writes "extension" properties in the given <see cref="ILaunchProfile"/>.
/// </para>
/// <para>"Extension" means properties that are stored in the <see cref="ILaunchProfile.OtherSettings"/>
/// dictionary, rather than in named properties of <see cref="ILaunchProfile"/>
/// itself. Those are handled by <see cref="LaunchProfileProjectProperties"/>.
/// </para>
/// </summary>
/// <remarks>
/// Not to be confused with <see cref="ActiveLaunchProfileExtensionValueProvider" />,
/// which serves a very similar purpose but reads and writes the _active_ profile
/// rather than a particular one, and will go away once the Launch Profiles UI is up
/// and running.
/// </remarks>
[ExportLaunchProfileExtensionValueProvider(
new[]
{
AuthenticationModePropertyName,
HotReloadEnabledPropertyName,
NativeDebuggingPropertyName,
RemoteDebugEnabledPropertyName,
RemoteDebugMachinePropertyName,
SqlDebuggingPropertyName,
WebView2DebuggingPropertyName
},
ExportLaunchProfileExtensionValueProviderScope.LaunchProfile)]
internal class ProjectLaunchProfileExtensionValueProvider : ILaunchProfileExtensionValueProvider
{
internal const string AuthenticationModePropertyName = "AuthenticationMode";
internal const string HotReloadEnabledPropertyName = "HotReloadEnabled";
internal const string NativeDebuggingPropertyName = "NativeDebugging";
internal const string RemoteDebugEnabledPropertyName = "RemoteDebugEnabled";
internal const string RemoteDebugMachinePropertyName = "RemoteDebugMachine";
internal const string SqlDebuggingPropertyName = "SqlDebugging";
internal const string WebView2DebuggingPropertyName = "WebView2Debugging";
// The CPS property system will map "true" and "false" to the localized versions of
// "Yes" and "No" for display purposes, but not other casings like "True" and
// "False". To ensure consistency we need to map booleans to these constants.
private const string True = "true";
private const string False = "false";
public string OnGetPropertyValue(string propertyName, ILaunchProfile launchProfile, ImmutableDictionary<string, object> globalSettings, Rule? rule)
{
string propertyValue = propertyName switch
{
AuthenticationModePropertyName => GetOtherProperty(launchProfile, LaunchProfileExtensions.RemoteAuthenticationModeProperty, string.Empty),
HotReloadEnabledPropertyName => GetOtherProperty(launchProfile, LaunchProfileExtensions.HotReloadEnabledProperty, true) ? True : False,
NativeDebuggingPropertyName => GetOtherProperty(launchProfile, LaunchProfileExtensions.NativeDebuggingProperty, false) ? True : False,
RemoteDebugEnabledPropertyName => GetOtherProperty(launchProfile, LaunchProfileExtensions.RemoteDebugEnabledProperty, false) ? True : False,
RemoteDebugMachinePropertyName => GetOtherProperty(launchProfile, LaunchProfileExtensions.RemoteDebugMachineProperty, string.Empty),
SqlDebuggingPropertyName => GetOtherProperty(launchProfile, LaunchProfileExtensions.SqlDebuggingProperty, false) ? True : False,
WebView2DebuggingPropertyName => GetOtherProperty(launchProfile, LaunchProfileExtensions.JSWebView2DebuggingProperty, false) ? True : False,
_ => throw new InvalidOperationException($"{nameof(ProjectLaunchProfileExtensionValueProvider)} does not handle property '{propertyName}'.")
};
return propertyValue;
}
public void OnSetPropertyValue(string propertyName, string propertyValue, IWritableLaunchProfile launchProfile, ImmutableDictionary<string, object> globalSettings, Rule? rule)
{
switch (propertyName)
{
case AuthenticationModePropertyName:
TrySetOtherProperty(launchProfile, LaunchProfileExtensions.RemoteAuthenticationModeProperty, propertyValue, string.Empty);
break;
case HotReloadEnabledPropertyName:
TrySetOtherProperty(launchProfile, LaunchProfileExtensions.HotReloadEnabledProperty, bool.Parse(propertyValue), true);
break;
case NativeDebuggingPropertyName:
TrySetOtherProperty(launchProfile, LaunchProfileExtensions.NativeDebuggingProperty, bool.Parse(propertyValue), false);
break;
case RemoteDebugEnabledPropertyName:
TrySetOtherProperty(launchProfile, LaunchProfileExtensions.RemoteDebugEnabledProperty, bool.Parse(propertyValue), false);
break;
case RemoteDebugMachinePropertyName:
TrySetOtherProperty(launchProfile, LaunchProfileExtensions.RemoteDebugMachineProperty, propertyValue, string.Empty);
break;
case SqlDebuggingPropertyName:
TrySetOtherProperty(launchProfile, LaunchProfileExtensions.SqlDebuggingProperty, bool.Parse(propertyValue), false);
break;
case WebView2DebuggingPropertyName:
TrySetOtherProperty(launchProfile, LaunchProfileExtensions.JSWebView2DebuggingProperty, bool.Parse(propertyValue), false);
break;
default:
throw new InvalidOperationException($"{nameof(ProjectLaunchProfileExtensionValueProvider)} does not handle property '{propertyName}'.");
}
}
private static T GetOtherProperty<T>(ILaunchProfile launchProfile, string propertyName, T defaultValue)
{
if (launchProfile.OtherSettings is null)
{
return defaultValue;
}
if (launchProfile.OtherSettings.TryGetValue(propertyName, out object? value) &&
value is T b)
{
return b;
}
else if (value is string s &&
TypeDescriptor.GetConverter(typeof(T)) is TypeConverter converter &&
converter.CanConvertFrom(typeof(string)))
{
try
{
if (converter.ConvertFromString(s) is T o)
{
return o;
}
}
catch (Exception)
{
// ignore bad data in the json file and just let them have the default value
}
}
return defaultValue;
}
private static bool TrySetOtherProperty<T>(IWritableLaunchProfile launchProfile, string propertyName, T value, T defaultValue) where T : notnull
{
if (!launchProfile.OtherSettings.TryGetValue(propertyName, out object current))
{
current = defaultValue;
}
if (current is not T currentTyped || !Equals(currentTyped, value))
{
launchProfile.OtherSettings[propertyName] = value;
return true;
}
return false;
}
}
}
| 50.398734 | 201 | 0.647369 | [
"MIT"
] | Ashishpatel2321/project-system | src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Properties/LaunchProfiles/ProjectLaunchProfileExtensionValueProvider.cs | 7,808 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Data.DataView;
using Microsoft.ML;
using Microsoft.ML.CommandLine;
using Microsoft.ML.Data;
using Microsoft.ML.ImageAnalytics;
using Microsoft.ML.Internal.Utilities;
using Microsoft.ML.Runtime;
using Microsoft.ML.Transforms;
[assembly: LoadableClass(ImageLoadingTransformer.Summary, typeof(IDataTransform), typeof(ImageLoadingTransformer), typeof(ImageLoadingTransformer.Options), typeof(SignatureDataTransform),
ImageLoadingTransformer.UserName, "ImageLoaderTransform", "ImageLoader")]
[assembly: LoadableClass(ImageLoadingTransformer.Summary, typeof(IDataTransform), typeof(ImageLoadingTransformer), null, typeof(SignatureLoadDataTransform),
ImageLoadingTransformer.UserName, ImageLoadingTransformer.LoaderSignature)]
[assembly: LoadableClass(typeof(ImageLoadingTransformer), null, typeof(SignatureLoadModel), "", ImageLoadingTransformer.LoaderSignature)]
[assembly: LoadableClass(typeof(IRowMapper), typeof(ImageLoadingTransformer), null, typeof(SignatureLoadRowMapper), "", ImageLoadingTransformer.LoaderSignature)]
namespace Microsoft.ML.ImageAnalytics
{
/// <summary>
/// The <see cref="ITransformer"/> produced by fitting an <see cref="IDataView"/> to an <see cref="ImageLoadingEstimator"/>.
/// </summary>
/// <remarks>
/// Calling <see cref="ITransformer.Transform(IDataView)"/> that loads images from the disk.
/// Loading is the first step of almost every pipeline that does image processing, and further analysis on images.
/// The images to load need to be in the formats supported by <see cref = "System.Drawing.Bitmap" />.
/// For end-to-end image processing pipelines, and scenarios in your applications, see the
/// <a href="https://github.com/dotnet/machinelearning-samples/tree/master/samples/csharp/getting-started"> examples in the machinelearning-samples github repository.</a>
/// <seealso cref = "ImageEstimatorsCatalog"/>
/// </remarks>
public sealed class ImageLoadingTransformer : OneToOneTransformerBase
{
internal sealed class Column : OneToOneColumn
{
internal static Column Parse(string str)
{
Contracts.AssertNonEmpty(str);
var res = new Column();
if (res.TryParse(str))
return res;
return null;
}
internal bool TryUnparse(StringBuilder sb)
{
Contracts.AssertValue(sb);
return TryUnparseCore(sb);
}
}
internal sealed class Options : TransformInputBase
{
[Argument(ArgumentType.Multiple | ArgumentType.Required, HelpText = "New column definition(s) (optional form: name:src)", Name = "Column", ShortName = "col", SortOrder = 1)]
public Column[] Columns;
[Argument(ArgumentType.AtMostOnce, HelpText = "Folder where to search for images", ShortName = "folder")]
public string ImageFolder;
}
internal const string Summary = "Load images from files.";
internal const string UserName = "Image Loader Transform";
internal const string LoaderSignature = "ImageLoaderTransform";
/// <summary>
/// The folder to load the images from.
/// </summary>
public readonly string ImageFolder;
/// <summary>
/// The columns passed to this <see cref="ITransformer"/>.
/// </summary>
internal IReadOnlyCollection<(string outputColumnName, string inputColumnName)> Columns => ColumnPairs.AsReadOnly();
/// <summary>
/// Initializes a new instance of <see cref="ImageLoadingTransformer"/>.
/// </summary>
/// <param name="env">The host environment.</param>
/// <param name="imageFolder">Folder where to look for images.</param>
/// <param name="columns">Names of input and output columns.</param>
internal ImageLoadingTransformer(IHostEnvironment env, string imageFolder = null, params (string outputColumnName, string inputColumnName)[] columns)
: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImageLoadingTransformer)), columns)
{
ImageFolder = imageFolder;
}
// Factory method for SignatureDataTransform.
internal static IDataTransform Create(IHostEnvironment env, Options options, IDataView data)
{
return new ImageLoadingTransformer(env, options.ImageFolder, options.Columns.Select(x => (x.Name, x.Source ?? x.Name)).ToArray())
.MakeDataTransform(data);
}
// Factory method for SignatureLoadModel.
private static ImageLoadingTransformer Create(IHostEnvironment env, ModelLoadContext ctx)
{
Contracts.CheckValue(env, nameof(env));
env.CheckValue(ctx, nameof(ctx));
ctx.CheckAtModel(GetVersionInfo());
return new ImageLoadingTransformer(env.Register(nameof(ImageLoadingTransformer)), ctx);
}
private ImageLoadingTransformer(IHost host, ModelLoadContext ctx)
: base(host, ctx)
{
// *** Binary format ***
// <base>
// int: id of image folder
ImageFolder = ctx.LoadStringOrNull();
}
// Factory method for SignatureLoadDataTransform.
private static IDataTransform Create(IHostEnvironment env, ModelLoadContext ctx, IDataView input)
=> Create(env, ctx).MakeDataTransform(input);
// Factory method for SignatureLoadRowMapper.
private static IRowMapper Create(IHostEnvironment env, ModelLoadContext ctx, DataViewSchema inputSchema)
=> Create(env, ctx).MakeRowMapper(inputSchema);
private protected override void CheckInputColumn(DataViewSchema inputSchema, int col, int srcCol)
{
if (!(inputSchema[srcCol].Type is TextDataViewType))
throw Host.ExceptSchemaMismatch(nameof(inputSchema), "input", ColumnPairs[col].inputColumnName, TextDataViewType.Instance.ToString(), inputSchema[srcCol].Type.ToString());
}
private protected override void SaveModel(ModelSaveContext ctx)
{
Host.CheckValue(ctx, nameof(ctx));
ctx.CheckAtModel();
ctx.SetVersionInfo(GetVersionInfo());
// *** Binary format ***
// <base>
// int: id of image folder
base.SaveColumns(ctx);
ctx.SaveStringOrNull(ImageFolder);
}
private static VersionInfo GetVersionInfo()
{
return new VersionInfo(
modelSignature: "IMGLOADR",
//verWrittenCur: 0x00010001, // Initial
verWrittenCur: 0x00010002, // Swith from OpenCV to Bitmap
verReadableCur: 0x00010002,
verWeCanReadBack: 0x00010002,
loaderSignature: LoaderSignature,
loaderAssemblyName: typeof(ImageLoadingTransformer).Assembly.FullName);
}
private protected override IRowMapper MakeRowMapper(DataViewSchema schema) => new Mapper(this, schema);
private sealed class Mapper : OneToOneMapperBase
{
private readonly ImageLoadingTransformer _parent;
private readonly ImageType _imageType;
public Mapper(ImageLoadingTransformer parent, DataViewSchema inputSchema)
: base(parent.Host.Register(nameof(Mapper)), parent, inputSchema)
{
_imageType = new ImageType();
_parent = parent;
}
protected override Delegate MakeGetter(DataViewRow input, int iinfo, Func<int, bool> activeOutput, out Action disposer)
{
Contracts.AssertValue(input);
Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
disposer = null;
var getSrc = input.GetGetter<ReadOnlyMemory<char>>(input.Schema[ColMapNewToOld[iinfo]]);
ReadOnlyMemory<char> src = default;
ValueGetter<Bitmap> del =
(ref Bitmap dst) =>
{
if (dst != null)
{
dst.Dispose();
dst = null;
}
getSrc(ref src);
if (src.Length > 0)
{
// Catch exceptions and pass null through. Should also log failures...
try
{
string path = src.ToString();
if (!string.IsNullOrWhiteSpace(_parent.ImageFolder))
path = Path.Combine(_parent.ImageFolder, path);
dst = new Bitmap(path);
}
catch (Exception)
{
// REVIEW: We catch everything since the documentation for new Bitmap(string)
// appears to be incorrect. When the file isn't found, it throws an ArgumentException,
// while the documentation says FileNotFoundException. Not sure what it will throw
// in other cases, like corrupted file, etc.
throw Host.Except($"Image {src.ToString()} was not found.");
}
// Check for an incorrect pixel format which indicates the loading failed
if (dst.PixelFormat == System.Drawing.Imaging.PixelFormat.DontCare)
throw Host.Except($"Failed to load image {src.ToString()}.");
}
};
return del;
}
protected override DataViewSchema.DetachedColumn[] GetOutputColumnsCore()
=> _parent.ColumnPairs.Select(x => new DataViewSchema.DetachedColumn(x.outputColumnName, _imageType, null)).ToArray();
}
}
/// <summary>
/// <see cref="IEstimator{TTransformer}"/> that loads images from the disk.
/// </summary>
/// <remarks>
/// Calling <see cref="IEstimator{TTransformer}.Fit(IDataView)"/> in this estimator, produces an <see cref="ImageLoadingTransformer"/>.
/// Loading is the first step of almost every pipeline that does image processing, and further analysis on images.
/// The images to load need to be in the formats supported by <see cref = "System.Drawing.Bitmap" />.
/// For end-to-end image processing pipelines, and scenarios in your applications, see the
/// <a href = "https://github.com/dotnet/machinelearning-samples/tree/master/samples/csharp/getting-started"> examples in the machinelearning-samples github repository.</a>
/// <seealso cref="ImageEstimatorsCatalog" />
/// </remarks>
public sealed class ImageLoadingEstimator : TrivialEstimator<ImageLoadingTransformer>
{
private readonly ImageType _imageType;
/// <summary>
/// Load images in memory.
/// </summary>
/// <param name="env">The host environment.</param>
/// <param name="imageFolder">Folder where to look for images.</param>
/// <param name="columns">Names of input and output columns.</param>
internal ImageLoadingEstimator(IHostEnvironment env, string imageFolder, params (string outputColumnName, string inputColumnName)[] columns)
: this(env, new ImageLoadingTransformer(env, imageFolder, columns))
{
}
internal ImageLoadingEstimator(IHostEnvironment env, ImageLoadingTransformer transformer)
: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImageLoadingEstimator)), transformer)
{
_imageType = new ImageType();
}
/// <summary>
/// Returns the <see cref="SchemaShape"/> of the schema which will be produced by the transformer.
/// Used for schema propagation and verification in a pipeline.
/// </summary>
public override SchemaShape GetOutputSchema(SchemaShape inputSchema)
{
Host.CheckValue(inputSchema, nameof(inputSchema));
var result = inputSchema.ToDictionary(x => x.Name);
foreach (var (outputColumnName, inputColumnName) in Transformer.Columns)
{
if (!inputSchema.TryFindColumn(inputColumnName, out var col))
throw Host.ExceptSchemaMismatch(nameof(inputSchema), "input", inputColumnName);
if (!(col.ItemType is TextDataViewType) || col.Kind != SchemaShape.Column.VectorKind.Scalar)
throw Host.ExceptSchemaMismatch(nameof(inputSchema), "input", inputColumnName, TextDataViewType.Instance.ToString(), col.GetTypeString());
result[outputColumnName] = new SchemaShape.Column(outputColumnName, SchemaShape.Column.VectorKind.Scalar, _imageType, false);
}
return new SchemaShape(result.Values);
}
}
}
| 47.311189 | 187 | 0.622053 | [
"MIT"
] | calcbench/machinelearning | src/Microsoft.ML.ImageAnalytics/ImageLoader.cs | 13,533 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraControl : MonoBehaviour
{
public BoolField movingCamera;
[Header("Input Senstivity")]
public FloatField swipeMagnitude;
public float swipeMultiplier = 0.15f;
public FloatField pinchMagnitude;
public float pinchMultiplier = 0.05f;
//lerping
private bool shouldLerp = false;
private Vector3 startPosition;
private Vector3 endPosition;
private float timeStartedLerping;
public float lerpTime = 1;
//raycasting
RaycastingForFloor rcaster;
[Header("Camera Properties")]
public CameraProperties cameraPorperties;
[Attributes.GreyOut]
public bool zoomEnabled = true;
//height
private float clampY;
private bool traverseVertical = true;
//zoom
private float clampZ;
private IEnumerator Lerping()
{
while (shouldLerp)
{
transform.position = Lerp(startPosition, endPosition, timeStartedLerping, lerpTime);
clampY = Mathf.Clamp(transform.position.y, cameraPorperties.minimumHeight, cameraPorperties.maximumHeight);
transform.position = new Vector3(transform.position.x, clampY, transform.position.z);
yield return new WaitForEndOfFrame();
}
}
public void TraverseUp()
{
if (traverseVertical)
{
timeStartedLerping = Time.time;
startPosition = transform.position;
endPosition = transform.position + (Vector3.up * swipeMultiplier * swipeMagnitude.GetValue());
shouldLerp = true;
StopAllCoroutines();
StartCoroutine(Lerping());
}
}
public void TraverseDown()
{
if (traverseVertical)
{
timeStartedLerping = Time.time;
startPosition = transform.position;
endPosition = transform.position + (Vector3.up * -swipeMultiplier * swipeMagnitude.GetValue());
shouldLerp = true;
movingCamera.BoolValue = true;
StopAllCoroutines();
StartCoroutine(Lerping());
}
}
public void TraverseVertical(bool cond)
{
traverseVertical = cond;
}
public void StopTraversing()
{
shouldLerp = false;
}
public void Zoom()
{
if (!zoomEnabled)
return;
if (Camera.main.orthographic)
{
Camera.main.orthographicSize = Mathf.Clamp(Camera.main.orthographicSize -
(pinchMultiplier * pinchMagnitude.GetValue()),
cameraPorperties.zoomOutMin, cameraPorperties.zoomOutMax);
}
else
{
Vector3 DesiredPosition = new Vector3(transform.position.x, transform.position.y,
transform.position.z + (pinchMultiplier * pinchMagnitude.GetValue()));
clampZ = Mathf.Clamp(DesiredPosition.z, cameraPorperties.minimumZoom, cameraPorperties.maximumZoom);
transform.position = new Vector3(transform.position.x, transform.position.y, clampZ);
}
}
Vector3 Lerp(Vector3 start, Vector3 end, float timeStartedLerping, float lerpTime = 1)
{
float timeSinceStarted = Time.time - timeStartedLerping;
float percentageComplete = timeSinceStarted / lerpTime;
var result = Vector3.Lerp(start, end, percentageComplete);
if (percentageComplete > 0.9f)
{
movingCamera.BoolValue = true;
shouldLerp = false;
}
return result;
}
private void OnDrawGizmos()
{
Gizmos.color = Color.green;
Gizmos.DrawLine(new Vector3(transform.position.x, cameraPorperties.minimumHeight, transform.position.z),
new Vector3(transform.position.x, cameraPorperties.maximumHeight, transform.position.z));
Gizmos.DrawLine(new Vector3(transform.position.x, transform.position.y, cameraPorperties.minimumZoom),
new Vector3(transform.position.x, transform.position.y, cameraPorperties.maximumZoom));
Gizmos.color = Color.blue;
Gizmos.DrawWireSphere(new Vector3(transform.position.x, cameraPorperties.minimumHeight, transform.position.z),
0.5f);
Gizmos.DrawWireSphere(new Vector3(transform.position.x, cameraPorperties.maximumHeight, transform.position.z),
0.5f);
Gizmos.DrawWireSphere(new Vector3(transform.position.x, transform.position.y, cameraPorperties.minimumZoom),
0.5f);
Gizmos.DrawWireSphere(new Vector3(transform.position.x, transform.position.y, cameraPorperties.maximumZoom),
0.5f);
}
}
| 31.721088 | 119 | 0.650869 | [
"Apache-2.0"
] | gitNader/ElMasna3-2.0 | Assets/Scripts/Camera/CameraControl.cs | 4,665 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MVC_CRUD.Models
{
using System;
using System.Collections.Generic;
public partial class TR_Role
{
public int RoleId { get; set; }
public string Rolename { get; set; }
public string RoleDesc { get; set; }
}
}
| 31.363636 | 85 | 0.504348 | [
"MIT"
] | faisalalfareza/crm-outbound-contactcenter-web | Models/TR_Role.cs | 690 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace Nucleo.Windows.Actions
{
public interface IEventSubscribingObject
{
void ReceiveEventNotification(EventAction action, object targetObject);
}
}
| 19 | 73 | 0.811404 | [
"MIT"
] | brianmains/Nucleo.NET | src/Nucleo.Windows/Windows/Actions/IEventSubscribingObject.cs | 230 | C# |
using System;
using Semver.Ranges.Comparers.Npm;
namespace Semver.Ranges
{
/// <summary>
/// Provides extension methods to <see cref="SemVersion"/> to check if the version satisfies a range.
/// </summary>
public static class SemVersionExtensions
{
/// <summary>
/// <para>
/// Checks if this version satisfies the specified range.
/// Uses the same range syntax as npm.
/// </para>
/// <para>
/// Note: It's more optimal to use the static parse methods on <see cref="NpmRange"/>
/// if you're gonna be testing multiple versions against the same range
/// to avoid having to parse the range multiple times.
/// </para>
/// </summary>
/// <param name="version"></param>
/// <param name="range">The range to compare with. If the syntax is invalid the method will always return false.</param>
/// <param name="options">The options to use when parsing the range.</param>
/// <returns>True if the version satisfies the range.</returns>
/// <exception cref="ArgumentNullException">Thrown if version or range is null.</exception>
public static bool SatisfiesNpm(this SemVersion version, string range, NpmParseOptions options = default)
{
if (version == null) throw new ArgumentNullException(nameof(version));
if (range == null) throw new ArgumentNullException(nameof(range));
if (!NpmRange.TryParse(range, options, out var parsedRange))
return false;
return parsedRange!.Includes(version);
}
/// <summary>
/// Checks if this version satisfies the specified range.
/// Uses the same syntax as npm.
/// </summary>
/// <param name="version"></param>
/// <param name="range">The range to compare with.</param>
/// <returns>True if the version satisfies the range.</returns>
/// <exception cref="ArgumentNullException">Thrown if version or range is null.</exception>
public static bool Satisfies(this SemVersion version, IRange range)
{
if (version == null) throw new ArgumentNullException(nameof(version));
if (range == null) throw new ArgumentNullException(nameof(range));
return range.Includes(version);
}
}
} | 44.830189 | 128 | 0.617424 | [
"MIT"
] | Jump-King-Multiplayer/JKMP.Core | JKMP.Core/SemVersion/Ranges/SemVersionExtensions.cs | 2,376 | C# |
namespace Application.Services;
using Domain.ValueObjects;
public interface ICurrencyExchange
{
Task<Money> Convert(Money originalAmount, Currency destinationCurrency);
} | 22.125 | 76 | 0.819209 | [
"MIT"
] | MartsTech/D-Wallet | packages/api/src/Application/Services/ICurrencyExchange.cs | 179 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ObjectModel;
using ObjectModel.Engine;
/// <summary>
/// Abstract class having common parallel manager implementation
/// </summary>
internal abstract class ParallelOperationManager<T, TU> : IParallelOperationManager, IDisposable
{
#region ConcurrentManagerInstanceData
protected Func<T> CreateNewConcurrentManager { get; set; }
/// <summary>
/// Gets a value indicating whether hosts are shared.
/// </summary>
protected bool SharedHosts { get; private set; }
private IDictionary<T, TU> _concurrentManagerHandlerMap;
/// <summary>
/// Singleton Instance of this class
/// </summary>
protected static T s_instance = default;
/// <summary>
/// Default number of Processes
/// </summary>
private int _currentParallelLevel = 0;
#endregion
#region Concurrency Keeper Objects
/// <summary>
/// LockObject to iterate our sourceEnumerator in parallel
/// We can use the sourceEnumerator itself as lockObject, but since its a changing object - it's risky to use it as one
/// </summary>
protected object _sourceEnumeratorLockObject = new();
#endregion
protected ParallelOperationManager(Func<T> createNewManager, int parallelLevel, bool sharedHosts)
{
CreateNewConcurrentManager = createNewManager;
SharedHosts = sharedHosts;
// Update Parallel Level
UpdateParallelLevel(parallelLevel);
}
/// <summary>
/// Remove and dispose a manager from concurrent list of manager.
/// </summary>
/// <param name="manager">Manager to remove</param>
public void RemoveManager(T manager)
{
_concurrentManagerHandlerMap.Remove(manager);
}
/// <summary>
/// Add a manager in concurrent list of manager.
/// </summary>
/// <param name="manager">Manager to add</param>
/// <param name="handler">eventHandler of the manager</param>
public void AddManager(T manager, TU handler)
{
_concurrentManagerHandlerMap.Add(manager, handler);
}
/// <summary>
/// Update event handler for the manager.
/// If it is a new manager, add this.
/// </summary>
/// <param name="manager">Manager to update</param>
/// <param name="handler">event handler to update for manager</param>
public void UpdateHandlerForManager(T manager, TU handler)
{
if (_concurrentManagerHandlerMap.ContainsKey(manager))
{
_concurrentManagerHandlerMap[manager] = handler;
}
else
{
AddManager(manager, handler);
}
}
/// <summary>
/// Get the event handler associated with the manager.
/// </summary>
/// <param name="manager">Manager</param>
public TU GetHandlerForGivenManager(T manager)
{
return _concurrentManagerHandlerMap[manager];
}
/// <summary>
/// Get total number of active concurrent manager
/// </summary>
public int GetConcurrentManagersCount()
{
return _concurrentManagerHandlerMap.Count;
}
/// <summary>
/// Get instances of all active concurrent manager
/// </summary>
public IEnumerable<T> GetConcurrentManagerInstances()
{
return _concurrentManagerHandlerMap.Keys.ToList();
}
/// <summary>
/// Updates the Concurrent Executors according to new parallel setting
/// </summary>
/// <param name="newParallelLevel">Number of Parallel Executors allowed</param>
public void UpdateParallelLevel(int newParallelLevel)
{
if (_concurrentManagerHandlerMap == null)
{
// not initialized yet
// create rest of concurrent clients other than default one
_concurrentManagerHandlerMap = new ConcurrentDictionary<T, TU>();
for (int i = 0; i < newParallelLevel; i++)
{
AddManager(CreateNewConcurrentManager(), default);
}
}
else if (_currentParallelLevel != newParallelLevel)
{
// If number of concurrent clients is less than the new level
// Create more concurrent clients and update the list
if (_currentParallelLevel < newParallelLevel)
{
for (int i = 0; i < newParallelLevel - _currentParallelLevel; i++)
{
AddManager(CreateNewConcurrentManager(), default);
}
}
else
{
// If number of concurrent clients is more than the new level
// Dispose off the extra ones
int managersCount = _currentParallelLevel - newParallelLevel;
foreach (var concurrentManager in GetConcurrentManagerInstances())
{
if (managersCount == 0)
{
break;
}
else
{
RemoveManager(concurrentManager);
managersCount--;
}
}
}
}
// Update current parallel setting to new one
_currentParallelLevel = newParallelLevel;
}
public void Dispose()
{
if (_concurrentManagerHandlerMap != null)
{
foreach (var managerInstance in GetConcurrentManagerInstances())
{
RemoveManager(managerInstance);
}
}
s_instance = default;
}
protected void DoActionOnAllManagers(Action<T> action, bool doActionsInParallel = false)
{
if (_concurrentManagerHandlerMap != null && _concurrentManagerHandlerMap.Count > 0)
{
int i = 0;
var actionTasks = new Task[_concurrentManagerHandlerMap.Count];
foreach (var client in GetConcurrentManagerInstances())
{
// Read the array before firing the task - beware of closures
if (doActionsInParallel)
{
actionTasks[i] = Task.Run(() => action(client));
i++;
}
else
{
DoManagerAction(() => action(client));
}
}
if (doActionsInParallel)
{
DoManagerAction(() => Task.WaitAll(actionTasks));
}
}
}
private void DoManagerAction(Action action)
{
try
{
action();
}
catch (Exception ex)
{
// Exception can occur if we are trying to cancel a test run on an executor where test run is not even fired
// we can safely ignore that as user is just canceling the test run and we don't care about additional parallel executors
// as we will be disposing them off soon anyway
if (EqtTrace.IsWarningEnabled)
{
EqtTrace.Warning("AbstractParallelOperationManager: Exception while invoking an action on Proxy Manager instance: {0}", ex);
}
}
}
/// <summary>
/// Fetches the next data object for the concurrent executor to work on
/// </summary>
/// <param name="source">source data to work on - source file or testCaseList</param>
/// <returns>True, if data exists. False otherwise</returns>
protected bool TryFetchNextSource<TY>(IEnumerator enumerator, out TY source)
{
source = default;
var hasNext = false;
lock (_sourceEnumeratorLockObject)
{
if (enumerator != null && enumerator.MoveNext())
{
source = (TY)enumerator.Current;
hasNext = source != null;
}
}
return hasNext;
}
} | 31.925781 | 140 | 0.593784 | [
"MIT"
] | lbussell/vstest | src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs | 8,173 | C# |
using DCSoft.Drawing;
using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
namespace DCSoft.WinForms
{
public class MultiColumTextDrawer
{
private int _MaxColumnWidth = 100;
private int _MinColumnWidth = 10;
private float _ContentWidth = 0f;
private ContentAlignment _Alignment = ContentAlignment.MiddleLeft;
private float[] _ColumnWidths = null;
private static StringFormat _StrFormat = null;
/// <summary>
/// 最大列宽
/// </summary>
public int MaxColumnWidth
{
get
{
return _MaxColumnWidth;
}
set
{
_MaxColumnWidth = value;
}
}
/// <summary>
/// 最小列宽
/// </summary>
public int MinColumnWidth
{
get
{
return _MinColumnWidth;
}
set
{
_MinColumnWidth = value;
}
}
/// <summary>
/// 视图宽度
/// </summary>
public float ContentWidth => _ContentWidth;
/// <summary>
/// 文本对齐方式
/// </summary>
public ContentAlignment Alignment
{
get
{
return _Alignment;
}
set
{
_Alignment = value;
if (_StrFormat != null)
{
_StrFormat.Dispose();
_StrFormat = null;
}
}
}
private StringFormat StrFormat
{
get
{
if (_StrFormat == null)
{
_StrFormat = new StringFormat(StringFormat.GenericTypographic);
DrawerUtil.SetStringFormatAlignment(_StrFormat, Alignment);
_StrFormat.FormatFlags = StringFormatFlags.NoWrap;
}
return _StrFormat;
}
}
public virtual int GetColumnNum(object item)
{
return 1;
}
public virtual string GetDisplayText(object item, int columnIndex)
{
if (item == null || DBNull.Value.Equals(item))
{
return null;
}
return Convert.ToString(item);
}
public virtual void RefreshLayout(Graphics graphics_0, IList items, Font font)
{
int num = 15;
if (graphics_0 == null)
{
throw new ArgumentNullException("g");
}
if (items == null)
{
throw new ArgumentNullException("items");
}
if (font == null)
{
throw new ArgumentNullException("font");
}
int num2 = 1;
foreach (object item in items)
{
int columnNum = GetColumnNum(item);
num2 = Math.Max(columnNum, num2);
}
_ColumnWidths = new float[num2];
foreach (object item2 in items)
{
int columnNum = GetColumnNum(item2);
for (int i = 0; i < columnNum; i++)
{
string displayText = GetDisplayText(item2, i);
if (!string.IsNullOrEmpty(displayText))
{
SizeF sizeF = graphics_0.MeasureString(displayText, font, 100000, StrFormat);
_ColumnWidths[i] = Math.Max(_ColumnWidths[i], sizeF.Width + 5f);
}
}
}
_ContentWidth = 0f;
for (int i = 0; i < _ColumnWidths.Length; i++)
{
float num3 = _ColumnWidths[i];
if (num3 > (float)MaxColumnWidth && MaxColumnWidth > 0)
{
num3 = MaxColumnWidth;
}
if (num3 < (float)MinColumnWidth && MinColumnWidth > 0)
{
num3 = MinColumnWidth;
}
_ColumnWidths[i] = num3;
_ContentWidth += num3;
}
}
public virtual void DrawItem(Graphics graphics_0, object item, RectangleF bounds, Font font, Color txtColor)
{
int columnNum = GetColumnNum(item);
float num = bounds.Left;
using (SolidBrush brush = new SolidBrush(txtColor))
{
for (int i = 0; i < columnNum; i++)
{
string displayText = GetDisplayText(item, i);
if (!string.IsNullOrEmpty(displayText))
{
RectangleF layoutRectangle = new RectangleF(num, bounds.Top, _ColumnWidths[i], bounds.Height);
graphics_0.DrawString(displayText, font, brush, layoutRectangle, StrFormat);
}
num += _ColumnWidths[i];
}
}
}
public void BindingOwnerDrawListBox(ListBox listBox_0)
{
int num = 10;
if (listBox_0 == null)
{
throw new ArgumentNullException("ctl");
}
if (listBox_0.IsDisposed)
{
throw new ObjectDisposedException("ctl");
}
using (Graphics graphics_ = listBox_0.CreateGraphics())
{
RefreshLayout(graphics_, listBox_0.Items, listBox_0.Font);
}
listBox_0.DrawMode = DrawMode.OwnerDrawFixed;
listBox_0.DrawItem += ctl_DrawItem;
}
public void RefreshLayout(ListBox listBox_0)
{
using (Graphics graphics_ = listBox_0.CreateGraphics())
{
RefreshLayout(graphics_, listBox_0.Items, listBox_0.Font);
}
}
private void ctl_DrawItem(object sender, DrawItemEventArgs e)
{
ListBox listBox = (ListBox)sender;
object item = listBox.Items[e.Index];
e.DrawBackground();
bool flag = false;
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
flag = true;
}
DrawItem(e.Graphics, item, e.Bounds, listBox.Font, flag ? SystemColors.HighlightText : SystemColors.ControlText);
if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
{
e.DrawFocusRectangle();
}
}
}
}
| 21.891892 | 116 | 0.640535 | [
"MIT"
] | h1213159982/HDF | Example/WinForm/Editor/DCWriter/DCSoft.Writer.Cleaned/DCSoft.WinForms/MultiColumTextDrawer.cs | 4,896 | C# |
using System;
namespace SFA.DAS.Payments.Automation.Domain.Specifications
{
public class LearnerRecord
{
public virtual string LearnerKey { get; set; }
public virtual LearnerType LearnerType { get; set; }
public virtual DateTime StartDate { get; set; }
public virtual DateTime PlannedEndDate { get; set; }
public virtual DateTime? ActualEndDate { get; set; }
public virtual CompletionStatus CompletionStatus { get; set; }
public virtual string ProviderKey { get; set; }
public virtual int TotalTrainingPrice1 { get; set; }
public virtual DateTime TotalTrainingPrice1EffectiveDate { get; set; }
public virtual int? TotalAssessmentPrice1 { get; set; }
public virtual DateTime? TotalAssessmentPrice1EffectiveDate { get; set; }
public virtual int? ResidualTrainingPrice1 { get; set; }
public virtual DateTime? ResidualTrainingPrice1EffectiveDate { get; set; }
public virtual int? ResidualAssessmentPrice1 { get; set; }
public virtual DateTime? ResidualAssessmentPrice1EffectiveDate { get; set; }
public virtual int? TotalTrainingPrice2 { get; set; }
public virtual DateTime? TotalTrainingPrice2EffectiveDate { get; set; }
public virtual int? TotalAssessmentPrice2 { get; set; }
public virtual DateTime? TotalAssessmentPrice2EffectiveDate { get; set; }
public virtual AimType AimType { get; set; }
public virtual string AimRate { get; set; }
public virtual long? StandardCode { get; set; }
public virtual int? FrameworkCode { get; set; }
public virtual int? ProgrammeType { get; set; }
public virtual int? PathwayCode { get; set; }
public virtual string HomePostcodeDeprivation { get; set; }
public virtual string EmploymentStatus { get; set; }
public virtual string EmploymentStatusApplies { get; set; }
public virtual string EmployerKey { get; set; }
public virtual string SmallEmployer { get; set; }
public virtual string LearnDelFam { get; set; }
public virtual int? ResidualTrainingPrice2 { get; set; }
public virtual DateTime? ResidualTrainingPrice2EffectiveDate { get; set; }
public virtual int? ResidualAssessmentPrice2 { get; set; }
public virtual DateTime? ResidualAssessmentPrice2EffectiveDate { get; set; }
public virtual int AimSequenceNumber { get; set; }
public virtual string LearnerReferenceNumber { get; set; }
}
}
| 54.021277 | 84 | 0.686885 | [
"MIT"
] | SkillsFundingAgency/das-providerpayments | src/AcceptanceTesting/IlrSubmissionPortal/SFA.DAS.Payments.Automation.Domain/Specifications/LearnerRecord.cs | 2,541 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OOSDDemo {
public partial class View_Blog1 {
/// <summary>
/// LabelMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelMessage;
/// <summary>
/// DataList1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DataList DataList1;
}
}
| 31.823529 | 84 | 0.489834 | [
"MIT"
] | sajeebchandan/University-Project-SWE331 | OOSDDemo/View Blog.aspx.designer.cs | 1,084 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/winnt.h in the Windows SDK for Windows 10.0.19041.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace TerraFX.Interop
{
public partial struct PRIVILEGE_SET
{
[NativeTypeName("DWORD")]
public uint PrivilegeCount;
[NativeTypeName("DWORD")]
public uint Control;
[NativeTypeName("LUID_AND_ATTRIBUTES [1]")]
public _Privilege_e__FixedBuffer Privilege;
public partial struct _Privilege_e__FixedBuffer
{
public LUID_AND_ATTRIBUTES e0;
public ref LUID_AND_ATTRIBUTES this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref AsSpan(int.MaxValue)[index];
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Span<LUID_AND_ATTRIBUTES> AsSpan(int length) => MemoryMarshal.CreateSpan(ref e0, length);
}
}
}
| 30.756098 | 145 | 0.647898 | [
"MIT"
] | Ethereal77/terrafx.interop.windows | sources/Interop/Windows/um/winnt/PRIVILEGE_SET.cs | 1,263 | C# |
namespace DeepNestSharp.Domain.Services
{
using System.Threading.Tasks;
public interface IFileIoService
{
Task<string> GetOpenFilePathAsync(string filter, string initialDirectory = null);
Task<string[]> GetOpenFilePathsAsync(string filter, string initialDirectory = null, bool allowMultiSelect = true);
bool Exists(string filePath);
string GetSaveFilePath(string fileDialogFilter, string fileName = null, string initialDirectory = null);
}
} | 31.333333 | 118 | 0.770213 | [
"MIT"
] | 9swampy/DeepNestSharp | DeepNestSharp.Domain/Services/IFileIoService.cs | 472 | C# |
// c:\program files (x86)\windows kits\10\include\10.0.22000.0\um\mfapi.h(3075,9)
using System;
using System.Runtime.InteropServices;
namespace DirectN
{
[StructLayout(LayoutKind.Sequential)]
public partial struct _MT_CUSTOM_VIDEO_PRIMARIES
{
public float fRx;
public float fRy;
public float fGx;
public float fGy;
public float fBx;
public float fBy;
public float fWx;
public float fWy;
}
}
| 24.6 | 83 | 0.623984 | [
"MIT"
] | Steph55/DirectN | DirectN/DirectN/Generated/_MT_CUSTOM_VIDEO_PRIMARIES.cs | 494 | C# |
namespace iMgmt
{
partial class frmSplash
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(-1, 328);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(602, 5);
this.progressBar1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Palatino Linotype", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.Black;
this.label1.Location = new System.Drawing.Point(81, 122);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(437, 39);
this.label1.TabIndex = 2;
this.label1.Text = "Inventory Management System";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.Transparent;
this.label3.Font = new System.Drawing.Font("Palatino Linotype", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.Color.Teal;
this.label3.Location = new System.Drawing.Point(57, 290);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(0, 18);
this.label3.TabIndex = 4;
//
// frmSplash
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::iMgmt.Properties.Resources.cloud_computing_laptop_smartphone_tablet;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(603, 334);
this.ControlBox = false;
this.Controls.Add(this.label3);
this.Controls.Add(this.label1);
this.Controls.Add(this.progressBar1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "frmSplash";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "frmSplash";
this.Load += new System.EventHandler(this.frmSplash_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
}
} | 42.923077 | 163 | 0.589382 | [
"Apache-2.0"
] | balavigneshs/iMgmt | iMgmt/frmSplash.Designer.cs | 4,466 | C# |
using System;
namespace SCNDISC.Server.Domain.Aggregates
{
public class Feedback : Aggregate
{
public string UserName { get; set; }
public string Message { get; set; }
public DateTime Created { get; set; }
}
} | 20 | 42 | 0.704545 | [
"MIT"
] | Dima2022/DiscountsApp | SCNDISC.Server/SCNDISC.Server.Domain/Aggregates/Feedback.cs | 222 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
/*
* Do not modify this file. This file is generated from the mediaconvert-2017-08-29.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.MediaConvert.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.MediaConvert.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for FileSourceSettings Object
/// </summary>
public class FileSourceSettingsUnmarshaller : IUnmarshaller<FileSourceSettings, XmlUnmarshallerContext>, IUnmarshaller<FileSourceSettings, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
FileSourceSettings IUnmarshaller<FileSourceSettings, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public FileSourceSettings Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
FileSourceSettings unmarshalledObject = new FileSourceSettings();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("convert608To708", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Convert608To708 = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("framerate", targetDepth))
{
var unmarshaller = CaptionSourceFramerateUnmarshaller.Instance;
unmarshalledObject.Framerate = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("sourceFile", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.SourceFile = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("timeDelta", targetDepth))
{
var unmarshaller = IntUnmarshaller.Instance;
unmarshalledObject.TimeDelta = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static FileSourceSettingsUnmarshaller _instance = new FileSourceSettingsUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static FileSourceSettingsUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 37.609091 | 168 | 0.603819 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/MediaConvert/Generated/Model/Internal/MarshallTransformations/FileSourceSettingsUnmarshaller.cs | 4,137 | C# |
/*
* File: Program.cs
* Author: Angelo Breuer
*
* The MIT License (MIT)
*
* Copyright (c) Angelo Breuer 2019
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace Lavalink4NET.Discord_NET.ExampleBot
{
using System;
using System.Threading.Tasks;
using Discord.Commands;
using Discord.WebSocket;
using Lavalink4NET.Logging;
using Lavalink4NET.MemoryCache;
using Microsoft.Extensions.DependencyInjection;
/// <summary>
/// Contains the main entry point.
/// </summary>
internal sealed class Program
{
/// <summary>
/// Starts the application.
/// </summary>
private static void Main()
=> RunAsync().GetAwaiter().GetResult();
/// <summary>
/// Runs the bot asynchronously.
/// </summary>
private static async Task RunAsync()
{
using (var serviceProvider = ConfigureServices())
{
var bot = serviceProvider.GetRequiredService<ExampleBot>();
var audio = serviceProvider.GetRequiredService<IAudioService>();
var logger = serviceProvider.GetRequiredService<ILogger>() as EventLogger;
logger.LogMessage += Log;
await bot.StartAsync();
await audio.InitializeAsync();
logger.Log(bot, "Example Bot is running. Press [Q] to stop.");
while (Console.ReadKey(true).Key != ConsoleKey.Q)
{
}
await bot.StopAsync();
}
}
private static void Log(object sender, LogMessageEventArgs args)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write($"[{args.Source.GetType().Name} {args.Level}] ");
Console.ResetColor();
Console.WriteLine(args.Message);
if (args.Exception != null)
{
Console.WriteLine(args.Exception);
}
}
/// <summary>
/// Configures the application services.
/// </summary>
/// <returns>the service provider</returns>
private static ServiceProvider ConfigureServices() => new ServiceCollection()
// Bot
.AddSingleton<ExampleBot>()
// Discord
.AddSingleton<DiscordSocketClient>()
.AddSingleton<CommandService>()
// Lavalink
.AddSingleton<IAudioService, LavalinkNode>()
.AddSingleton<IDiscordClientWrapper, DiscordClientWrapper>()
.AddSingleton<ILogger, EventLogger>()
.AddSingleton(new LavalinkNodeOptions
{
// Your Node Configuration
})
// Request Caching for Lavalink
.AddSingleton<ILavalinkCache, LavalinkCache>()
.BuildServiceProvider();
}
} | 34.347826 | 90 | 0.612152 | [
"MIT"
] | Erwin-J/Lavalink4NET | samples/Lavalink4NET.Discord_NET.ExampleBot/Program.cs | 3,950 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.Sql
{
/// <summary>
/// An instance failover group.
/// API Version: 2020-08-01-preview.
/// </summary>
[AzureNextGenResourceType("azure-nextgen:sql:InstanceFailoverGroup")]
public partial class InstanceFailoverGroup : Pulumi.CustomResource
{
/// <summary>
/// List of managed instance pairs in the failover group.
/// </summary>
[Output("managedInstancePairs")]
public Output<ImmutableArray<Outputs.ManagedInstancePairInfoResponse>> ManagedInstancePairs { get; private set; } = null!;
/// <summary>
/// Resource name.
/// </summary>
[Output("name")]
public Output<string> Name { get; private set; } = null!;
/// <summary>
/// Partner region information for the failover group.
/// </summary>
[Output("partnerRegions")]
public Output<ImmutableArray<Outputs.PartnerRegionInfoResponse>> PartnerRegions { get; private set; } = null!;
/// <summary>
/// Read-only endpoint of the failover group instance.
/// </summary>
[Output("readOnlyEndpoint")]
public Output<Outputs.InstanceFailoverGroupReadOnlyEndpointResponse?> ReadOnlyEndpoint { get; private set; } = null!;
/// <summary>
/// Read-write endpoint of the failover group instance.
/// </summary>
[Output("readWriteEndpoint")]
public Output<Outputs.InstanceFailoverGroupReadWriteEndpointResponse> ReadWriteEndpoint { get; private set; } = null!;
/// <summary>
/// Local replication role of the failover group instance.
/// </summary>
[Output("replicationRole")]
public Output<string> ReplicationRole { get; private set; } = null!;
/// <summary>
/// Replication state of the failover group instance.
/// </summary>
[Output("replicationState")]
public Output<string> ReplicationState { get; private set; } = null!;
/// <summary>
/// Resource type.
/// </summary>
[Output("type")]
public Output<string> Type { get; private set; } = null!;
/// <summary>
/// Create a InstanceFailoverGroup resource with the given unique name, arguments, and options.
/// </summary>
///
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public InstanceFailoverGroup(string name, InstanceFailoverGroupArgs args, CustomResourceOptions? options = null)
: base("azure-nextgen:sql:InstanceFailoverGroup", name, args ?? new InstanceFailoverGroupArgs(), MakeResourceOptions(options, ""))
{
}
private InstanceFailoverGroup(string name, Input<string> id, CustomResourceOptions? options = null)
: base("azure-nextgen:sql:InstanceFailoverGroup", name, null, MakeResourceOptions(options, id))
{
}
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
{
var defaultOptions = new CustomResourceOptions
{
Version = Utilities.Version,
Aliases =
{
new Pulumi.Alias { Type = "azure-nextgen:sql/v20171001preview:InstanceFailoverGroup"},
new Pulumi.Alias { Type = "azure-nextgen:sql/v20200202preview:InstanceFailoverGroup"},
new Pulumi.Alias { Type = "azure-nextgen:sql/v20200801preview:InstanceFailoverGroup"},
},
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
// Override the ID if one was specified for consistency with other language SDKs.
merged.Id = id ?? merged.Id;
return merged;
}
/// <summary>
/// Get an existing InstanceFailoverGroup resource's state with the given name, ID, and optional extra
/// properties used to qualify the lookup.
/// </summary>
///
/// <param name="name">The unique name of the resulting resource.</param>
/// <param name="id">The unique provider ID of the resource to lookup.</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public static InstanceFailoverGroup Get(string name, Input<string> id, CustomResourceOptions? options = null)
{
return new InstanceFailoverGroup(name, id, options);
}
}
public sealed class InstanceFailoverGroupArgs : Pulumi.ResourceArgs
{
/// <summary>
/// The name of the failover group.
/// </summary>
[Input("failoverGroupName")]
public Input<string>? FailoverGroupName { get; set; }
/// <summary>
/// The name of the region where the resource is located.
/// </summary>
[Input("locationName", required: true)]
public Input<string> LocationName { get; set; } = null!;
[Input("managedInstancePairs", required: true)]
private InputList<Inputs.ManagedInstancePairInfoArgs>? _managedInstancePairs;
/// <summary>
/// List of managed instance pairs in the failover group.
/// </summary>
public InputList<Inputs.ManagedInstancePairInfoArgs> ManagedInstancePairs
{
get => _managedInstancePairs ?? (_managedInstancePairs = new InputList<Inputs.ManagedInstancePairInfoArgs>());
set => _managedInstancePairs = value;
}
[Input("partnerRegions", required: true)]
private InputList<Inputs.PartnerRegionInfoArgs>? _partnerRegions;
/// <summary>
/// Partner region information for the failover group.
/// </summary>
public InputList<Inputs.PartnerRegionInfoArgs> PartnerRegions
{
get => _partnerRegions ?? (_partnerRegions = new InputList<Inputs.PartnerRegionInfoArgs>());
set => _partnerRegions = value;
}
/// <summary>
/// Read-only endpoint of the failover group instance.
/// </summary>
[Input("readOnlyEndpoint")]
public Input<Inputs.InstanceFailoverGroupReadOnlyEndpointArgs>? ReadOnlyEndpoint { get; set; }
/// <summary>
/// Read-write endpoint of the failover group instance.
/// </summary>
[Input("readWriteEndpoint", required: true)]
public Input<Inputs.InstanceFailoverGroupReadWriteEndpointArgs> ReadWriteEndpoint { get; set; } = null!;
/// <summary>
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// </summary>
[Input("resourceGroupName", required: true)]
public Input<string> ResourceGroupName { get; set; } = null!;
public InstanceFailoverGroupArgs()
{
}
}
}
| 41.898305 | 147 | 0.626079 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/dotnet/Sql/InstanceFailoverGroup.cs | 7,416 | C# |
using System.Text.Json;
using System.Threading.Tasks;
using PlaywrightSharp.Tests.BaseTests;
using Xunit;
using Xunit.Abstractions;
namespace PlaywrightSharp.Tests.Page.Network
{
///<playwright-file>network.spec.js</playwright-file>
///<playwright-describe>Response.json</playwright-describe>
public class ResponseJsonTests : PlaywrightSharpPageBaseTest
{
internal ResponseJsonTests(ITestOutputHelper output) : base(output)
{
}
///<playwright-file>network.spec.js</playwright-file>
///<playwright-describe>Response.json</playwright-describe>
///<playwright-it>should work</playwright-it>
[Fact]
public async Task ShouldWork()
{
var response = await Page.GoToAsync(TestConstants.ServerUrl + "/simple.json");
Assert.Equal(JsonDocument.Parse("{foo: 'bar'}"), await response.GetJsonAsync());
}
}
}
| 33.821429 | 93 | 0.658923 | [
"MIT"
] | slang25/playwright-sharp | src/PlaywrightSharp.Tests/Page/Network/ResponseJsonTests.cs | 947 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Firebase.Firestore;
using UniModules.UniCore.Runtime.ReflectionUtils;
using UniModules.UniCore.Runtime.Utils;
using UniModules.UniGame.RemoteData;
public static class ReactiveRemoteDataTool
{
private static List<Type> _emptyList = new List<Type>();
private static MemorizeItem<Type, List<Type>> _reactiveModelCache = MemorizeTool.Memorize<Type,List<Type>>(x =>
{
if (!x.HasCustomAttribute<FirestoreDataAttribute>())
{
return _emptyList;
}
var genericRemoteData = typeof(IReactiveRemoteObject<>).MakeGenericType(x);
var reactiveRemoteData = genericRemoteData.GetAssignableTypes();
return reactiveRemoteData;
});
public static IReadOnlyList<Type> GetReactiveModelTypes<T>() => _reactiveModelCache[typeof(T)];
public static IReadOnlyList<Type> GetReactiveModelTypes(Type type) => _reactiveModelCache[type];
public static Type GetFirstReactiveModelType<T>() => GetFirstReactiveModelType(typeof(T));
public static Type GetFirstReactiveModelType(Type type) => _reactiveModelCache[type].FirstOrDefault();
} | 35.909091 | 115 | 0.740084 | [
"MIT"
] | UniGameTeam/UniGame.RemoteData | Runtime/ReactiveRemoteDataTool.cs | 1,187 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.