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 ACadSharp.Geometry; using CSUtilities.Converters; using CSUtilities.IO; using CSUtilities.Text; using System; using System.Collections.Generic; using System.IO; using System.Text; namespace ACadSharp.IO.DWG { internal abstract class DwgStreamReader : StreamIO, IDwgStreamReader { public Encoding Encoding { get; set; } = Encoding.Default; public int BitShift { get; set; } public override long Position { get => m_stream.Position; set { m_stream.Position = value; BitShift = 0; } } public bool IsEmpty { get; private set; } = false; protected byte m_lastByte; public DwgStreamReader(Stream stream, bool resetPosition) : base(stream, resetPosition) { } //******************************************************************* public static IDwgStreamReader GetStreamHandler(ACadVersion version, Stream stream, bool resetPositon = false) { switch (version) { case ACadVersion.Unknown: throw new Exception(); case ACadVersion.MC0_0: case ACadVersion.AC1_2: case ACadVersion.AC1_4: case ACadVersion.AC1_50: case ACadVersion.AC2_10: case ACadVersion.AC1002: case ACadVersion.AC1003: case ACadVersion.AC1004: case ACadVersion.AC1006: case ACadVersion.AC1009: throw new NotSupportedException(); case ACadVersion.AC1012: case ACadVersion.AC1014: return new DwgStreamReaderAC12(stream, resetPositon); case ACadVersion.AC1015: return new DwgStreamReaderAC15(stream, resetPositon); case ACadVersion.AC1018: return new DwgStreamReaderAC18(stream, resetPositon); case ACadVersion.AC1021: return new DwgStreamReaderAC21(stream, resetPositon); case ACadVersion.AC1024: case ACadVersion.AC1027: case ACadVersion.AC1032: return new DwgStreamReaderAC24(stream, resetPositon); default: break; } return null; } //******************************************************************* public override byte ReadByte() { if (BitShift == 0) { //No need to apply the shift m_lastByte = base.ReadByte(); return m_lastByte; } //Get the last bits from the last readed byte byte lastValues = (byte)((uint)m_lastByte << BitShift); m_lastByte = base.ReadByte(); return (byte)(lastValues | (uint)(byte)((uint)m_lastByte >> 8 - BitShift)); } public override byte[] ReadBytes(int length) { byte[] numArray = new byte[length]; applyShiftToArr(length, numArray); return numArray; } public long SetPositionByFlag(long position) { SetPositionInBits(position); //String stream present bit (last bit in pre-handles section). bool flag = ReadBit(); long startPositon = position; if (flag) { //String stream present //If 1, then the “endbit” location should be decremented by 16 bytes applyFlagToPosition(position, out long length, out long size); startPositon = length - size; SetPositionInBits(startPositon); } else { //Mark as empty IsEmpty = true; //There is no information, set the position to the end Position = Stream.Length; } return startPositon; } #region Read BIT CODES AND DATA DEFINITIONS /// <inheritdoc/> public bool ReadBit() { if (BitShift == 0) { AdvanceByte(); bool result = (m_lastByte & 128) == 128; BitShift = 1; return result; } bool value = (m_lastByte << BitShift & 128) == 128; ++BitShift; BitShift &= 7; return value; } /// <inheritdoc/> public short ReadBitAsShort() { return ReadBit() ? (short)1 : (short)0; } /// <inheritdoc/> public byte Read2Bits() { byte value; if (BitShift == 0) { AdvanceByte(); value = (byte)((uint)m_lastByte >> 6); BitShift = 2; } else if (BitShift == 7) { byte lastValue = (byte)(m_lastByte << 1 & 2); AdvanceByte(); value = (byte)(lastValue | (uint)(byte)((uint)m_lastByte >> 7)); BitShift = 1; } else { value = (byte)(m_lastByte >> 6 - BitShift & 3); ++BitShift; ++BitShift; BitShift &= 7; } return value; } /// <inheritdoc/> public short ReadBitShort() { short value; switch (Read2Bits()) { case 0: //00 : A short (2 bytes) follows, little-endian order (LSB first) value = ReadShort<LittleEndianConverter>(); break; case 1: //01 : An unsigned char (1 byte) follows if (BitShift == 0) { AdvanceByte(); value = m_lastByte; break; } value = applyShiftToLasByte(); break; case 2: //10 : 0 value = 0; break; case 3: //11 : 256 value = 256; break; default: throw new Exception(); } return value; } /// <inheritdoc/> public bool ReadBitShortAsBool() { return ReadBitShort() != 0; } /// <inheritdoc/> public int ReadBitLong() { int value; switch (Read2Bits()) { case 0: //00 : A long (4 bytes) follows, little-endian order (LSB first) value = ReadInt<LittleEndianConverter>(); break; case 1: //01 : An unsigned char (1 byte) follows if (BitShift == 0) { AdvanceByte(); value = m_lastByte; break; } value = applyShiftToLasByte(); break; case 2: //10 : 0 value = 0; break; default: //11 : not used throw new Exception(); } return value; } /// <inheritdoc/> public long ReadBitLongLong() { ulong value = 0; byte size = read3bits(); for (int i = 0; i < size; ++i) { ulong b = ReadByte(); value += b << (i << 3); } return (long)value; } /// <inheritdoc/> public double ReadBitDouble() { double value; switch (Read2Bits()) { case 0: value = ReadDouble<LittleEndianConverter>(); break; case 1: value = 1.0; break; case 2: value = 0.0; break; default: throw new Exception(); } return value; } /// <inheritdoc/> public XY Read2BitDouble() { return new XY(ReadBitDouble(), ReadBitDouble()); } /// <inheritdoc/> public XYZ Read3BitDouble() { return new XYZ(ReadBitDouble(), ReadBitDouble(), ReadBitDouble()); } /// <inheritdoc/> public char ReadRawChar() { return (char)ReadByte(); } /// <inheritdoc/> public long ReadRawLong() { return ReadInt(); } /// <inheritdoc/> public XY Read2RawDouble() { return new XY(ReadDouble(), ReadDouble()); } /// <inheritdoc/> public ulong ReadModularChar() { int shift = 0; byte lastByte = ReadByte(); //REmove the flag ulong value = (ulong)(lastByte & 0b01111111); if ((lastByte & 0b10000000) != 0) { while (true) { shift += 7; byte last = ReadByte(); value |= (ulong)(last & 0b01111111) << shift; //Check flag if ((last & 0b10000000) == 0) break; } } return value; } /// <inheritdoc/> public int ReadSignedModularChar() { //Modular characters are a method of storing compressed integer values. They are used in the object map to //indicate both handle offsets and file location offsets.They consist of a stream of bytes, terminating when //the high bit of the byte is 0. int value; if (BitShift == 0) { //No shift, read normal AdvanceByte(); //Check if the current byte if ((m_lastByte & 0b10000000) == 0) //Check the flag { //Drop the flags value = m_lastByte & 0b00111111; //Check the sign flag if ((m_lastByte & 0b01000000) > 0U) value = -value; } else { int totalShift = 0; int sum = m_lastByte & sbyte.MaxValue; while (true) { //Shift to apply totalShift += 7; AdvanceByte(); //Check if the highest byte is 0 if ((m_lastByte & 0b10000000) != 0) sum |= (m_lastByte & sbyte.MaxValue) << totalShift; else break; } //Drop the flags at the las byte, and add it's value value = sum | (m_lastByte & 0b00111111) << totalShift; //Check the sign flag if ((m_lastByte & 0b01000000) > 0U) value = -value; } } else { //Apply the shift to each byte byte lastByte = applyShiftToLasByte(); if ((lastByte & 0b10000000) == 0) { //Drop the flags value = lastByte & 0b00111111; //Check the sign flag if ((lastByte & 0b01000000) > 0U) value = -value; } else { int totalShift = 0; int sum = lastByte & sbyte.MaxValue; byte currByte; while (true) { //Shift to apply totalShift += 7; currByte = applyShiftToLasByte(); //Check if the highest byte is 0 if ((currByte & 0b10000000) != 0) sum |= (currByte & sbyte.MaxValue) << totalShift; else break; } //Drop the flags at the las byte, and add it's value value = sum | (currByte & 0b00111111) << totalShift; //Check the sign flag if ((currByte & 0b01000000) > 0U) value = -value; } } return value; } /// <inheritdoc/> public int ReadModularShort() { int shift = 0b1111; //Read the bytes that form the short byte b1 = ReadByte(); byte b2 = ReadByte(); bool flag = (b2 & 0b10000000) == 0; //Set the value in little endian int value = b1 | (b2 & 0b1111111) << 8; while (!flag) { //Read 2 more bytes byte ub1 = ReadByte(); byte ub2 = ReadByte(); //Check the flag flag = (ub2 & 0b10000000) == 0; int secondShift = shift + 8; //Set the value in little endian value = value | ub1 << shift | (b2 & 0b1111111) << secondShift; //Update the shift shift = secondShift + 7; } return value; } #region Handle reference /// <inheritdoc/> public ulong HandleReference() { return HandleReference(0UL, out ReferenceType _); } /// <inheritdoc/> public ulong HandleReference(ulong referenceHandle) { return HandleReference(referenceHandle, out ReferenceType _); } /// <inheritdoc/> public ulong HandleReference(ulong referenceHandle, out ReferenceType reference) { //|CODE (4 bits)|COUNTER (4 bits)|HANDLE or OFFSET| byte form = ReadByte(); //CODE of the reference byte code = (byte)((uint)form >> 4); //COUNTER tells how many bytes of HANDLE follow. int counter = form & 0b00001111; //Get the reference type reading the last 2 bits reference = (ReferenceType)((uint)code & 0b0011); ulong initialPos; //0x2, 0x3, 0x4, 0x5 none - just read offset and use it as the result if (code <= 0x5) initialPos = readHandle(counter); //0x6 result is reference handle + 1 (length is 0 in this case) else if (code == 0x6) initialPos = ++referenceHandle; //0x8 result is reference handle – 1 (length is 0 in this case) else if (code == 0x8) initialPos = --referenceHandle; //0xA result is reference handle plus offset else if (code == 0xA) { ulong offset = readHandle(counter); initialPos = referenceHandle + offset; } //0xC result is reference handle minus offset else if (code == 0xC) { ulong offset = readHandle(counter); initialPos = referenceHandle - offset; } else { throw new Exception(); } return initialPos; } private ulong readHandle(int length) { byte[] raw = new byte[length]; byte[] arr = new byte[8]; if (Stream.Read(raw, 0, length) < length) //Error in header reader throw new EndOfStreamException(); if (BitShift == 0) { //Set the array backwards for (int i = 0; i < length; ++i) arr[length - 1 - i] = raw[i]; } else { int shift = 8 - BitShift; for (int i = 0; i < length; ++i) { //Get the last byte value byte lastByteValue = (byte)((uint)m_lastByte << BitShift); //Save the last byte m_lastByte = raw[i]; //Add the value of the next byte to the current byte value = (byte)(lastByteValue | (uint)(byte)((uint)m_lastByte >> shift)); //Save the value into the array arr[length - 1 - i] = value; } } //Set the left bytes to 0 for (int index = length; index < 8; ++index) arr[index] = 0; return LittleEndianConverter.Instance.ToUInt64(arr); } #endregion /// <inheritdoc/> public virtual string ReadTextUnicode() { int textLength = ReadShort(); int encodingKey = ReadByte(); string value; if (textLength == 0) { value = string.Empty; } else { value = ReadString(textLength, TextEncoding.GetListedEncoding((CodePage)encodingKey)); } return value; } /// <inheritdoc/> public abstract string ReadVariableText(); /// <inheritdoc/> public byte[] ReadSentinel() { return ReadBytes(16); } /// <inheritdoc/> public XYZ Read3BitDoubleWithDefault(XYZ defValues) { return new XYZ( ReadBitDoubleWithDefault(defValues.X), ReadBitDoubleWithDefault(defValues.Y), ReadBitDoubleWithDefault(defValues.Z)); } /// <inheritdoc/> public virtual Color ReadCmColor() { //R15 and earlier: BS color index short colorIndex = ReadBitShort(); //TODO: Finish the color implementation return new Color(); } /// <inheritdoc/> public virtual Color ReadEnColor(out Transparency transparency, out bool flag) { Color color = new Color(); flag = false; //BS : color index (always 0) short colorNumber = ReadBitShort(); transparency = Transparency.ByLayer; color.Index = colorNumber; return color; } /// <inheritdoc/> public virtual ObjectType ReadObjectType() { //Until R2007, the object type was a bit short. return (ObjectType)ReadBitShort(); } /// <inheritdoc/> public virtual XYZ ReadBitExtrusion() { //For R13-R14 this is 3BD. return Read3BitDouble(); } /// <inheritdoc/> public double ReadBitDoubleWithDefault(double def) { //Get the bytes form the default value byte[] arr = LittleEndianConverter.Instance.GetBytes(def); switch (Read2Bits()) { //00 No more data present, use the value of the default double. case 0: return def; //01 4 bytes of data are present. The result is the default double, with the 4 data bytes patched in //replacing the first 4 bytes of the default double(assuming little endian). case 1: if (BitShift == 0) { AdvanceByte(); arr[0] = m_lastByte; AdvanceByte(); arr[1] = m_lastByte; AdvanceByte(); arr[2] = m_lastByte; AdvanceByte(); arr[3] = m_lastByte; } else { int shift = 8 - BitShift; arr[0] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[0] |= (byte)((uint)m_lastByte >> shift); arr[1] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[1] |= (byte)((uint)m_lastByte >> shift); arr[2] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[2] |= (byte)((uint)m_lastByte >> shift); arr[3] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[3] |= (byte)((uint)m_lastByte >> shift); } return LittleEndianConverter.Instance.ToDouble(arr); //10 6 bytes of data are present. The result is the default double, with the first 2 data bytes patched in //replacing bytes 5 and 6 of the default double, and the last 4 data bytes patched in replacing the first 4 //bytes of the default double(assuming little endian). case 2: if (BitShift == 0) { AdvanceByte(); arr[4] = m_lastByte; AdvanceByte(); arr[5] = m_lastByte; AdvanceByte(); arr[0] = m_lastByte; AdvanceByte(); arr[1] = m_lastByte; AdvanceByte(); arr[2] = m_lastByte; AdvanceByte(); arr[3] = m_lastByte; } else { arr[4] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[4] |= (byte)((uint)m_lastByte >> 8 - BitShift); arr[5] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[5] |= (byte)((uint)m_lastByte >> 8 - BitShift); arr[0] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[0] |= (byte)((uint)m_lastByte >> 8 - BitShift); arr[1] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[1] |= (byte)((uint)m_lastByte >> 8 - BitShift); arr[2] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[2] |= (byte)((uint)m_lastByte >> 8 - BitShift); arr[3] = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); arr[3] |= (byte)((uint)m_lastByte >> 8 - BitShift); } return LittleEndianConverter.Instance.ToDouble(arr); //11 A full RD follows. case 3: return ReadDouble(); default: throw new Exception(); } } /// <inheritdoc/> public virtual double ReadBitThickness() { //For R13-R14, this is a BD. return ReadBitDouble(); } #endregion /// <inheritdoc/> public DateTime ReadDateTime() { ReadBitLong(); ReadBitLong(); //TODO: implement the date time creation with 2 long return new DateTime(); } /// <inheritdoc/> public TimeSpan ReadTimeSpan() { ReadBitLong(); ReadBitLong(); //TODO: implement the time span creation with 2 long return new TimeSpan(); } #region Stream pointer control /// <inheritdoc/> public long PositionInBits() { long bitPosition = Stream.Position * 8L; if ((uint)BitShift > 0U) bitPosition += BitShift - 8; return bitPosition; } /// <inheritdoc/> public void SetPositionInBits(long position) { Position = position >> 3; BitShift = (int)(position & 7L); if ((uint)BitShift <= 0U) return; AdvanceByte(); } /// <inheritdoc/> public void AdvanceByte() { m_lastByte = base.ReadByte(); } /// <inheritdoc/> public void Advance(int offset) { if (offset > 1) Stream.Position += offset - 1; ReadByte(); } /// <inheritdoc/> public ushort ResetShift() { //Reset the shift value if ((uint)BitShift > 0U) BitShift = 0; AdvanceByte(); ushort num = m_lastByte; AdvanceByte(); return (ushort)(num | (uint)(ushort)((uint)m_lastByte << 8)); } #endregion //******************************************************************* protected virtual void applyFlagToPosition(long lastPos, out long length, out long strDataSize) { //If 1, then the “endbit” location should be decremented by 16 bytes length = lastPos - 16L; SetPositionInBits(length); //short should be read at location endbit – 128 (bits) strDataSize = ReadUShort(); //If this short has the 0x8000 bit set, //then decrement endbit by an additional 16 bytes, //strip the 0x8000 bit off of strDataSize, and read //the short at this new location, calling it hiSize. if (((ulong)strDataSize & 0x8000) <= 0UL) return; length -= 16; SetPositionInBits(length); strDataSize &= short.MaxValue; int hiSize = ReadUShort(); //Then set strDataSize to (strDataSize | (hiSize << 15)) strDataSize += (hiSize & ushort.MaxValue) << 15; //All unicode strings in this object are located in the “string stream”, //and should be read from this stream, even though the location of the //TV type fields in the object descriptions list these fields in among //the normal object data. } protected byte applyShiftToLasByte() { byte value = (byte)((uint)m_lastByte << BitShift); AdvanceByte(); return (byte)((uint)value | (byte)((uint)m_lastByte >> 8 - BitShift)); } private void applyShiftToArr(int length, byte[] arr) { //Empty Stream if (Stream.Read(arr, 0, length) != length) throw new EndOfStreamException(); if ((uint)BitShift <= 0U) return; int shift = 8 - BitShift; for (int i = 0; i < length; ++i) { //Get the last byte value byte lastByteValue = (byte)((uint)m_lastByte << BitShift); //Save the last byte m_lastByte = arr[i]; //Add the value of the next byte to the current byte value = (byte)(lastByteValue | (uint)(byte)((uint)m_lastByte >> shift)); //Save the value into the array arr[i] = value; } } private byte read3bits() { byte b1 = 0; if (ReadBit()) b1 = 1; byte b2 = (byte)((uint)b1 << 1); if (ReadBit()) b2 |= 1; byte b3 = (byte)((uint)b2 << 1); if (ReadBit()) b3 |= 1; return b3; } } }
23.79883
112
0.606694
[ "MIT" ]
SoftBIM/ACadSharp
ACadSharp/IO/DWG/DwgStreamReaders/DwgStreamReader.cs
20,366
C#
using Snark.Client; namespace Snark.Events.System { public abstract class BaseSystemEvent : ISystemEvent { public BaseSystemEvent(ServiceIdentifier service) { this.Service = service; } public ServiceIdentifier Service { get; private set; } public abstract string Type { get; } } }
20.529412
62
0.633238
[ "MIT" ]
chrisalexander/snark
Snark/Events/System/BaseSystemEvent.cs
351
C#
using ksp.blog.membership.Entities; using System; namespace ksp.blog.membership { public interface IMembershipService : IDisposable { void Registration(RegistrationModel model); void Login(string userName, string password); void LogOut(); } }
20.714286
53
0.675862
[ "MIT" ]
Farhankaioum/asp.netcore_blog_App
ksp.blog/ksp.blog.membership/IMembershipService.cs
292
C#
// // System.Net.HttpWebResponse (for 2.1 profile) // // Authors: // Jb Evain <jbevain@novell.com> // // (c) 2007 Novell, Inc. (http://www.novell.com) // // // 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. // #if NET_2_1 using System.IO; namespace System.Net { public abstract class WebResponse : IDisposable { private WebHeaderCollection headers; public abstract long ContentLength { get; } public abstract string ContentType { get; } public abstract Uri ResponseUri { get; } public virtual WebHeaderCollection Headers { get { if (!SupportsHeaders) throw NotImplemented (); return headers; } } internal WebHeaderCollection InternalHeaders { get { return headers; } set { headers = value; } } public virtual bool SupportsHeaders { get { return false; } } protected WebResponse () { } public abstract void Close (); public abstract Stream GetResponseStream (); void IDisposable.Dispose () { Close (); } static Exception NotImplemented () { // hide the "normal" NotImplementedException from corcompare-like tools return new NotImplementedException (); } } } #endif
26.337349
74
0.721409
[ "Apache-2.0" ]
121468615/mono
mcs/class/System.Net/System.Net/WebResponse_2_1.cs
2,186
C#
namespace XpressTest; public class NamedObjectDifferentTypeRegisteredException<TExpectedType> : Exception { public NamedObjectDifferentTypeRegisteredException( string name, Type actualType ) : base($"Expected object with name {name} to be of type {typeof(TExpectedType).Name} but is actually of type {actualType.Name}") { ExpectedType = typeof(TExpectedType); ActualType = actualType; } public Type ExpectedType { get; } public Type ActualType { get; } }
27.631579
134
0.691429
[ "MIT" ]
JonnyOrman/XpressTest
Code/XpressTest/NamedObjectDifferentTypeRegisteredException.cs
525
C#
namespace Nager.Country.Translation.CountryInfos { /// <summary> /// Saint Vincent and the Grenadines /// </summary> public class SaintVincentAndTheGrenadinesCountryTranslation : ICountryTranslation { ///<inheritdoc/> public TranslationInfo[] Translations => new [] { new TranslationInfo(LanguageCode.AR, "سانت فينسنت والغرينادين"), new TranslationInfo(LanguageCode.AZ, "Sent-Vinsent və Qrenadinlər"), new TranslationInfo(LanguageCode.BE, "Сент-Вінсент і Грэнадзіны"), new TranslationInfo(LanguageCode.BG, "Сейнт Винсънт и Гренадини"), new TranslationInfo(LanguageCode.BS, "Sveti Vinsent i Grenadin"), new TranslationInfo(LanguageCode.CA, "Saint Vincent i les Grenadines"), new TranslationInfo(LanguageCode.CS, "Svatý Vincenc a Grenadiny"), new TranslationInfo(LanguageCode.DA, "Saint Vincent og Grenadinerne"), new TranslationInfo(LanguageCode.DE, "St. Vincent und die Grenadinen"), new TranslationInfo(LanguageCode.EL, "Άγιος Βικέντιος και Γρεναδίνες"), new TranslationInfo(LanguageCode.EN, "Saint Vincent and the Grenadines"), new TranslationInfo(LanguageCode.ES, "San Vicente y las Granadinas"), new TranslationInfo(LanguageCode.ET, "Saint Vincent ja Grenadiinid"), new TranslationInfo(LanguageCode.FA, "سنت وینسنت و گرنادین"), new TranslationInfo(LanguageCode.FI, "Saint Vincent ja Grenadiinit"), new TranslationInfo(LanguageCode.FR, "Saint-Vincent et les Grenadines"), new TranslationInfo(LanguageCode.HE, "סנט וינסנט והגרנדינים"), new TranslationInfo(LanguageCode.HR, "Sveti Vincent i Grenadini"), new TranslationInfo(LanguageCode.HU, "Saint Vincent és a Grenadine-szigetek"), new TranslationInfo(LanguageCode.HY, "Սենթ Վինսենթ և Գրենադիններ"), new TranslationInfo(LanguageCode.ID, "Saint Vincent dan the Grenadines"), new TranslationInfo(LanguageCode.IT, "Saint Vincent e Grenadine"), new TranslationInfo(LanguageCode.JA, "セントビンセントおよびグレナディーン諸島"), new TranslationInfo(LanguageCode.KA, "სენტ-ვინსენტი და გრენადინები"), new TranslationInfo(LanguageCode.KK, "Сент-Винсент және Гренадин аралдары"), new TranslationInfo(LanguageCode.KO, "세인트빈센트 그레나딘"), new TranslationInfo(LanguageCode.KY, "Сент-Винсент жана Гренадиналар"), new TranslationInfo(LanguageCode.LT, "Šventasis Vincentas ir Grenadinai"), new TranslationInfo(LanguageCode.LV, "Sentvinsenta un Grenadīnas"), new TranslationInfo(LanguageCode.MK, "Свети Винсент и Гренадините"), new TranslationInfo(LanguageCode.MN, "Сэнт Винсэнт ба Гренадин"), new TranslationInfo(LanguageCode.NB, "Saint Vincent og Grenadinene"), new TranslationInfo(LanguageCode.NL, "Saint Vincent en de Grenadines"), new TranslationInfo(LanguageCode.NN, "Saint Vincent og Grenadinane"), new TranslationInfo(LanguageCode.PL, "Saint Vincent i Grenadyny"), new TranslationInfo(LanguageCode.PT, "São Vicente e Granadinas"), new TranslationInfo(LanguageCode.RO, "Saint Vincent și Grenadinele"), new TranslationInfo(LanguageCode.RU, "Сент-Винсент и Гренадины"), new TranslationInfo(LanguageCode.SK, "Svätý Vincent a Grenadíny"), new TranslationInfo(LanguageCode.SL, "Saint Vincent in Grenadine"), new TranslationInfo(LanguageCode.SR, "Сент Винсент и Гренадини"), new TranslationInfo(LanguageCode.SV, "Saint Vincent och Grenadinerna"), new TranslationInfo(LanguageCode.TR, "Saint Vincent ve Grenadinler"), new TranslationInfo(LanguageCode.UK, "Сент-Вінсент і Гренадини"), new TranslationInfo(LanguageCode.UZ, "Sent-Vinsent va Grenadin"), new TranslationInfo(LanguageCode.ZH, "圣文森及格瑞那丁"), }; } }
66.147541
90
0.68228
[ "MIT" ]
OpenBoxLab/Nager.Country
src/Nager.Country.Translation/CountryTranslations/SaintVincentAndTheGrenadinesCountryTranslation.cs
4,489
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; namespace ImageProcessing { /* Cyan: [0; 1] Magenta: [0; 1] Yellow: [0; 1] Black: [0; 1] */ public class CmykColor { public double Cyan { get; set; } public double Magenta { get; set; } public double Yellow { get; set; } public double Black { get; set; } public CmykColor() { Cyan = 0; Magenta = 0; Yellow = 0; Black = 0; } public CmykColor(double cyan, double magenta, double yellow, double black) { Cyan = cyan; Magenta = magenta; Yellow = yellow; Black = black; } } }
16.414634
76
0.641902
[ "MIT" ]
GreenComfyTea/Image-Processing
Image Processing/classes/CmykColor.cs
675
C#
using System; using Android.App; using Android.Content.PM; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Xamarin.RisePlugin.Droid.Floatingactionbutton; namespace App2.Droid { [Activity(Label = "App2", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); } public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) { Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); base.OnRequestPermissionsResult(requestCode, permissions, grantResults); } public override void SetContentView(Android.Views.View view) { RootView.View = (Android.Widget.RelativeLayout)view; base.SetContentView(view); } } }
39.564103
180
0.686973
[ "MIT" ]
Druffl3/Xamarin.RisePlugin.Floatingactionbutton
Sample/App2/App2.Android/MainActivity.cs
1,545
C#
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using SportsBook.Domain.SeedWork; namespace SportsBook.Infrastructure.Repository { public class GenericRepositoryAsync<TEntity> : BaseRepository<TEntity>, IGenericRepositoryAsync<TEntity> where TEntity : class, IEntity { public GenericRepositoryAsync(DbContext context) : base(context) { } public Task AddAsync(TEntity entity) { throw new NotImplementedException(); } public Task AddAsync(params TEntity[] entities) { throw new NotImplementedException(); } public Task AddAsync(IEnumerable<TEntity> entities) { throw new NotImplementedException(); } public void Dispose() { throw new NotImplementedException(); } public IEnumerable<TEntity> GetAsync(Expression<Func<TEntity, bool>> filter = null, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, string includeProperties = "") { throw new NotImplementedException(); } public TEntity GetListAsync(object id) { throw new NotImplementedException(); } } }
28.659574
192
0.651076
[ "MIT" ]
dandevb/SportsBook
SportsBook.Infrastructure/Repository/GenericRepositoryAsync.cs
1,349
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. namespace MvvmCross.Views { using System; using System.Threading.Tasks; using MvvmCross.Exceptions; using Nivaes.App.Cross; using Nivaes.App.Cross.Logging; using Nivaes.App.Cross.ViewModels; public static class MvxViewExtensions { public static async ValueTask OnViewCreate(this IMvxView view, Func<ValueTask<IMvxViewModel?>> viewModelLoader) { if (view == null) throw new ArgumentNullException(nameof(view)); if (viewModelLoader == null) throw new ArgumentNullException(nameof(viewModelLoader)); // note - we check the DataContent before the ViewModel to avoid casting errors // in the case of 'simple' binding code if (view.DataContext != null) return; if (view.ViewModel != null) return; var viewModel = await viewModelLoader().ConfigureAwait(false); if (viewModel == null) { //MvxLog.Instance?.Warn("ViewModel not loaded for view {0}", view.GetType().Name); return; } view.ViewModel = viewModel; } public static void OnViewNewIntent(this IMvxView view, Func<IMvxViewModel> viewModelLoader) { //MvxLog.Instance?.Warn( // "OnViewNewIntent isn't well understood or tested inside MvvmCross - it's not really a cross-platform concept."); throw new MvxException("OnViewNewIntent is not implemented"); } public static void OnViewDestroy(this IMvxView view) { // nothing needed currently } public static Type FindAssociatedViewModelTypeOrNull(this IMvxView view) { if (view == null) return null; IMvxViewModelTypeFinder associatedTypeFinder; if (!Mvx.IoCProvider.TryResolve(out associatedTypeFinder)) { //MvxLog.Instance?.Trace( // "No view model type finder available - assuming we are looking for a splash screen - returning null"); return typeof(MvxNullViewModel); } return associatedTypeFinder.FindTypeOrNull(view.GetType()); } public static IMvxViewModel ReflectionGetViewModel(this IMvxView view) { var propertyInfo = view?.GetType().GetProperty("ViewModel"); return (IMvxViewModel)propertyInfo?.GetGetMethod().Invoke(view, new object[] { }); } public static IMvxBundle CreateSaveStateBundle(this IMvxView view) { if (view == null) throw new ArgumentNullException(nameof(view)); var viewModel = view.ViewModel; if (viewModel == null) return new MvxBundle(); return viewModel.SaveStateBundle(); } } }
35.860465
130
0.610895
[ "MIT" ]
Nivaes/Nivaes.App.Cross
Nivaes.App.Cross/Components/Views/MvxViewExtensions.cs
3,086
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; using Newtonsoft.Json.Linq; public class Pokedex : MonoBehaviour { public GameObject pokedex; public GameObject btnPokedex; [Header("Url Pokedex")] private string urlPokedex = "https://pokeapi.co/api/v2/pokemon?limit=10&offset="; private string urlComplete; private string offset; private int index; [Header("Url Images Pokedex")] private string urlImagesPokemons = "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/"; // + 1.png private string urlCompleteImagesPokemons; private Texture2D texturePokemons; private List<Texture2D> imgPokemons; [Header("Data - Logic")] private DataPokemons responsePokemonsGeneral; public RectTransform ParentPanel; private GameObject[] goButtonPokemons; private int cantDestroy; [Header("Panel Data Pokemons")] public GameObject panelDataPokemons; private string specificPokemon; private Texture2D textureSpecificPokemon; private DataSpecificPokemon dataSpecificPokemon; public RectTransform ParentPanelInfoSpecific; private Text txtId, txtName, txtHeight, txtWeidth, txtExperience, txtLocation, txtability1, txtability2; private string locationPokemon; private string idPokemon; public RawImage imgSpecific; private void Start() { index = 0; offset = index.ToString(); // StartCoroutine(GetPokemons()); // StartCoroutine(GetDataSpecificPokemon()); // StartCoroutine(GetLocationPokemon()); } public IEnumerator GetPokemons() { urlComplete = urlPokedex + offset; UnityWebRequest www = UnityWebRequest.Get(urlComplete); www.timeout = 10; yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.LogError("Algo salio mal"); } else { if (www.isDone) { string jsonResult = System.Text.Encoding.UTF8.GetString(www.downloadHandler.data); // Debug.Log("Json Result pokemon: " + jsonResult); responsePokemonsGeneral = JsonUtility.FromJson<DataPokemons>(jsonResult); // Debug.Log("root del pokemon: " + responsePokemonsGeneral.results.Count); goButtonPokemons = new GameObject[responsePokemonsGeneral.results.Count]; for (int i = 0; i < responsePokemonsGeneral.results.Count; i++) { cantDestroy += 1; goButtonPokemons[i] = Instantiate(Resources.Load("ButtonPokems", typeof(GameObject))) as GameObject; goButtonPokemons[i].GetComponentInChildren<Text>().text = responsePokemonsGeneral.results[i].name; goButtonPokemons[i].transform.SetParent(ParentPanel, false); string urlPokemon = responsePokemonsGeneral.results[i].url; goButtonPokemons[i].GetComponent<Button>().onClick.AddListener(() => ButtonClicked(urlPokemon)); } StartCoroutine(GetImagesPokemons()); } } } public IEnumerator GetOneImgPokemon() { urlCompleteImagesPokemons = urlImagesPokemons + idPokemon + ".png"; // Debug.Log("url image: " + urlCompleteImagesPokemons); UnityWebRequest www = UnityWebRequest.Get(urlCompleteImagesPokemons); DownloadHandlerTexture textPokemon = new DownloadHandlerTexture(true); www.downloadHandler = textPokemon; www.timeout = 10; yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.LogError("Algo salio mal"); } else { if (www.isDone) { string jsonResult = System.Text.Encoding.UTF8.GetString(www.downloadHandler.data); // Debug.Log("Json Result images: " + jsonResult); textureSpecificPokemon = textPokemon.texture; imgSpecific.texture = textureSpecificPokemon; } } } public IEnumerator GetImagesPokemons() { for (int i = index; i < goButtonPokemons.Length + index; i++) { int aux = i + 1; urlCompleteImagesPokemons = urlImagesPokemons + aux + ".png"; // Debug.Log("url image: " + urlCompleteImagesPokemons); UnityWebRequest www = UnityWebRequest.Get(urlCompleteImagesPokemons); DownloadHandlerTexture textPokemon = new DownloadHandlerTexture(true); www.downloadHandler = textPokemon; www.timeout = 10; yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.LogError("Algo salio mal"); } else { if (www.isDone) { string jsonResult = System.Text.Encoding.UTF8.GetString(www.downloadHandler.data); // Debug.Log("Json Result images: " + jsonResult); texturePokemons = textPokemon.texture; goButtonPokemons[i - index].GetComponentInChildren<RawImage>().texture = texturePokemons; goButtonPokemons[i - index].GetComponentInChildren<RawImage>().SetNativeSize(); goButtonPokemons[i - index].GetComponentInChildren<RawImage>().transform.localScale = new Vector2(0.5f, 0.5f); } } } } public IEnumerator GetDataSpecificPokemon() { // // UnityWebRequest www = UnityWebRequest.Get("https://pokeapi.co/api/v2/pokemon/1/"); UnityWebRequest www = UnityWebRequest.Get(specificPokemon); www.timeout = 10; yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.LogError("Algo salio mal"); } else { if (www.isDone) { string jsonResult = System.Text.Encoding.UTF8.GetString(www.downloadHandler.data); Debug.Log("Json Result pokemon: " + jsonResult); dataSpecificPokemon = JsonUtility.FromJson<DataSpecificPokemon>(jsonResult); locationPokemon = dataSpecificPokemon.location_area_encounters; txtId = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtId.text = "# " + dataSpecificPokemon.id.ToString(); txtId.transform.SetParent(ParentPanelInfoSpecific, false); txtName = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtName.text = "Name: " + dataSpecificPokemon.name.ToString(); txtName.transform.SetParent(ParentPanelInfoSpecific, false); txtHeight = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtHeight.text = "Height: " + dataSpecificPokemon.height.ToString(); txtHeight.transform.SetParent(ParentPanelInfoSpecific, false); txtWeidth = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtWeidth.text = "Weight: " + dataSpecificPokemon.weight.ToString(); txtWeidth.transform.SetParent(ParentPanelInfoSpecific, false); txtExperience = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtExperience.text = "Base Experience: " + dataSpecificPokemon.base_experience.ToString(); txtExperience.transform.SetParent(ParentPanelInfoSpecific, false); JObject jo = JObject.Parse(www.downloadHandler.text); string ability1 = jo["abilities"][0]["ability"]["name"].Value<string>(); string ability2 = jo["abilities"][1]["ability"]["name"].Value<string>(); txtability1 = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtability1.text = "Ability 1: " + ability1; txtability1.transform.SetParent(ParentPanelInfoSpecific, false); txtability2 = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtability2.text = "Ability 2: " + ability2; txtability2.transform.SetParent(ParentPanelInfoSpecific, false); idPokemon = dataSpecificPokemon.id.ToString(); StartCoroutine(GetLocationPokemon()); StartCoroutine(GetOneImgPokemon()); } } } public IEnumerator GetLocationPokemon() { // UnityWebRequest www = UnityWebRequest.Get("https://pokeapi.co/api/v2/pokemon/1/encounters"); //UnityWebRequest www = UnityWebRequest.Get(locationPokemon); www.timeout = 10; yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.LogError("Algo salio mal"); } else { if (www.isDone) { string jsonResult = System.Text.Encoding.UTF8.GetString(www.downloadHandler.data); Debug.Log("Json Result pokemon: " + jsonResult); JArray ja = JArray.Parse(www.downloadHandler.text); string namelocationPokemon = ja[0]["location_area"]["name"].Value<string>(); Debug.Log("nombre de ubicacion: " + namelocationPokemon); // JObject jo = JObject.Parse(www.downloadHandler.text); // locationPokemon = jo["location_area"].Value<string>(); txtLocation = Instantiate(Resources.Load("TextInfo", typeof(Text))) as Text; txtLocation.text = "Ubicacion: " + namelocationPokemon; txtLocation.transform.SetParent(ParentPanelInfoSpecific, false); } } } public void NextList10() { DestroyAllButtons(); index += 10; offset = index.ToString(); StartCoroutine(GetPokemons()); } public void BackList10() { if (index == 0) { Debug.Log("no hay de este lado"); } else { DestroyAllButtons(); index -= 10; offset = index.ToString(); StartCoroutine(GetPokemons()); } } public void DestroyAllButtons() { Debug.Log("Cantidad a destruir :" + cantDestroy); for (int i = 0; i < cantDestroy; i++) { Destroy(goButtonPokemons[i].gameObject); } cantDestroy = 0; } public void ButtonClicked(string _urlPokemon) //le agrego un listener dynamico al boton que se le agrega a c/u del os botones enlistados { specificPokemon = _urlPokemon; Debug.Log("Button clicked = " + specificPokemon); pokedex.SetActive(false); panelDataPokemons.SetActive(true); StartCoroutine(GetDataSpecificPokemon()); } public void CloseDataPokemons() { pokedex.SetActive(true); panelDataPokemons.SetActive(false); //clean vars imgSpecific.texture = null; Destroy(txtId.gameObject); Destroy(txtName.gameObject); Destroy(txtHeight.gameObject); Destroy(txtWeidth.gameObject); Destroy(txtExperience.gameObject); Destroy(txtability1.gameObject); Destroy(txtability2.gameObject); Destroy(txtLocation.gameObject); } public void OpenPokedex() { pokedex.SetActive(true); btnPokedex.SetActive(false); offset = "0"; StartCoroutine(GetPokemons()); } public void ClosePokedex() { index = 0; offset = index.ToString(); DestroyAllButtons(); pokedex.SetActive(false); btnPokedex.SetActive(true); } }
35.265306
140
0.59995
[ "MIT" ]
cheitovilla/PokemonGO
Assets/Scrips/Pokedex.cs
12,098
C#
// CodeContracts // // Copyright (c) Microsoft Corporation // // All rights reserved. // // MIT License // // 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. // File System.Windows.Media.Geometry.cs // Automatically generated contract file. using System.Collections.Generic; using System.IO; using System.Text; using System.Diagnostics.Contracts; using System; // Disable the "this variable is not used" warning as every field would imply it. #pragma warning disable 0414 // Disable the "this variable is never assigned to". #pragma warning disable 0067 // Disable the "this event is never assigned to". #pragma warning disable 0649 // Disable the "this variable is never used". #pragma warning disable 0169 // Disable the "new keyword not required" warning. #pragma warning disable 0109 // Disable the "extern without DllImport" warning. #pragma warning disable 0626 // Disable the "could hide other member" warning, can happen on certain properties. #pragma warning disable 0108 namespace System.Windows.Media { abstract public partial class Geometry : System.Windows.Media.Animation.Animatable, IFormattable, System.Windows.Media.Composition.DUCE.IResource { #region Methods and constructors public Geometry Clone() { return default(Geometry); } public Geometry CloneCurrentValue() { return default(Geometry); } public static PathGeometry Combine(Geometry geometry1, Geometry geometry2, GeometryCombineMode mode, Transform transform, double tolerance, ToleranceType type) { return default(PathGeometry); } public static PathGeometry Combine(Geometry geometry1, Geometry geometry2, GeometryCombineMode mode, Transform transform) { return default(PathGeometry); } public bool FillContains(System.Windows.Point hitPoint) { return default(bool); } public bool FillContains(System.Windows.Point hitPoint, double tolerance, ToleranceType type) { return default(bool); } public bool FillContains(Geometry geometry) { return default(bool); } public bool FillContains(Geometry geometry, double tolerance, ToleranceType type) { return default(bool); } public IntersectionDetail FillContainsWithDetail(Geometry geometry) { return default(IntersectionDetail); } public virtual new IntersectionDetail FillContainsWithDetail(Geometry geometry, double tolerance, ToleranceType type) { return default(IntersectionDetail); } internal Geometry() { } public virtual new double GetArea(double tolerance, ToleranceType type) { return default(double); } public double GetArea() { return default(double); } public PathGeometry GetFlattenedPathGeometry() { return default(PathGeometry); } public virtual new PathGeometry GetFlattenedPathGeometry(double tolerance, ToleranceType type) { return default(PathGeometry); } public virtual new PathGeometry GetOutlinedPathGeometry(double tolerance, ToleranceType type) { return default(PathGeometry); } public PathGeometry GetOutlinedPathGeometry() { return default(PathGeometry); } public System.Windows.Rect GetRenderBounds(Pen pen) { return default(System.Windows.Rect); } public virtual new System.Windows.Rect GetRenderBounds(Pen pen, double tolerance, ToleranceType type) { return default(System.Windows.Rect); } public virtual new PathGeometry GetWidenedPathGeometry(Pen pen, double tolerance, ToleranceType type) { return default(PathGeometry); } public PathGeometry GetWidenedPathGeometry(Pen pen) { return default(PathGeometry); } public abstract bool IsEmpty(); public abstract bool MayHaveCurves(); public static Geometry Parse(string source) { return default(Geometry); } public bool ShouldSerializeTransform() { return default(bool); } public bool StrokeContains(Pen pen, System.Windows.Point hitPoint, double tolerance, ToleranceType type) { return default(bool); } public bool StrokeContains(Pen pen, System.Windows.Point hitPoint) { return default(bool); } public IntersectionDetail StrokeContainsWithDetail(Pen pen, Geometry geometry, double tolerance, ToleranceType type) { return default(IntersectionDetail); } public IntersectionDetail StrokeContainsWithDetail(Pen pen, Geometry geometry) { return default(IntersectionDetail); } string System.IFormattable.ToString(string format, IFormatProvider provider) { return default(string); } int System.Windows.Media.Composition.DUCE.IResource.GetChannelCount() { return default(int); } public string ToString(IFormatProvider provider) { return default(string); } #endregion #region Properties and indexers public virtual new System.Windows.Rect Bounds { get { return default(System.Windows.Rect); } } public static System.Windows.Media.Geometry Empty { get { return default(System.Windows.Media.Geometry); } } public static double StandardFlatteningTolerance { get { return default(double); } } public Transform Transform { get { return default(Transform); } set { } } #endregion #region Fields public readonly static System.Windows.DependencyProperty TransformProperty; #endregion } }
27.59751
463
0.707863
[ "MIT" ]
Acidburn0zzz/CodeContracts
Microsoft.Research/Contracts/PresentationCore/Sources/System.Windows.Media.Geometry.cs
6,651
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; using Academatica.Api.Common.Data; using Academatica.Api.Common.Models; using Academatica.Api.Course.DTOs; using Academatica.Api.Course.Services; using Academatica.Api.Course.Services.Grpc; using Academatica.Api.Users.DTOs; using Academatica.Api.Users.Services.RabbitMQ; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Academatica.Api.Course.Controllers { /// <summary> /// Controller responsible for handling requests related to the Academatica course. /// </summary> [ApiController] [Route("api/course")] [Authorize(AuthenticationSchemes = "Bearer")] public class CourseController : ControllerBase { private readonly AcadematicaDbContext _academaticaDbContext; private readonly IPracticeAchievementsDataClient _practiceAchievementsDataClient; private readonly IMessageBusClient _messageBusClient; public CourseController( AcadematicaDbContext academaticaDbContext, IPracticeAchievementsDataClient practiceAchievementsDataClient, IMessageBusClient messageBusClient) { _academaticaDbContext = academaticaDbContext; _practiceAchievementsDataClient = practiceAchievementsDataClient; _messageBusClient = messageBusClient; } /// <summary> /// Endpoint used to get upcoming lessons for the authenticated user. /// </summary> /// <returns>Upcoming classes.</returns> [HttpGet] [Route("classes/upcoming")] public IActionResult GetUpcomingLessons() { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var algebraClasses = _academaticaDbContext.Classes .Where(x => x.IsAlgebraClass) .ToList() .OrderBy(x => x.Id, new ClassIdComparer()); var geometryClasses = _academaticaDbContext.Classes .Where(x => !x.IsAlgebraClass) .ToList() .OrderBy(x => x.Id, new ClassIdComparer()); List<UpcomingClassDto> upcomingClasses = new List<UpcomingClassDto>(); foreach (var alClass in algebraClasses) { var isFinished = _academaticaDbContext.UserClasses .Where(x => x.UserId.ToString() == userId && x.ClassId == alClass.Id) .FirstOrDefault() != null; if (!isFinished) { Topic classTopic = _academaticaDbContext.Topics.Where(x => x.Id == alClass.TopicId).FirstOrDefault(); if (classTopic == null) { continue; } int topicClassCount = _academaticaDbContext.Classes.Where(x => x.TopicId == classTopic.Id).Count(); string topicName = classTopic.Name; int classNumber = int.Parse(alClass.Id.Split('-').LastOrDefault()); upcomingClasses.Add(new UpcomingClassDto() { Id = alClass.Id, TopicId = alClass.TopicId, TierId = alClass.TierId, Name = alClass.Name, Description = alClass.Description, ExpReward = alClass.ExpReward, ImageUrl = alClass.ImageUrl, ClassNumber = classNumber, IsAlgebraClass = alClass.IsAlgebraClass, ProblemNum = alClass.ProblemNum, TheoryUrl = alClass.TheoryUrl, TopicClassCount = topicClassCount, TopicName = topicName }); break; } } foreach (var geomClass in geometryClasses) { var isFinished = _academaticaDbContext.UserClasses .Where(x => x.UserId.ToString() == userId && x.ClassId == geomClass.Id) .FirstOrDefault() != null; if (!isFinished) { Topic classTopic = _academaticaDbContext.Topics.Where(x => x.Id == geomClass.TopicId).FirstOrDefault(); if (classTopic == null) { continue; } int topicClassCount = _academaticaDbContext.Classes.Where(x => x.TopicId == classTopic.Id).Count(); string topicName = classTopic.Name; int classNumber = int.Parse(geomClass.Id.Split('-').LastOrDefault()); upcomingClasses.Add(new UpcomingClassDto() { Id = geomClass.Id, TopicId = geomClass.TopicId, TierId = geomClass.TierId, Name = geomClass.Name, Description = geomClass.Description, ExpReward = geomClass.ExpReward, ImageUrl = geomClass.ImageUrl, ClassNumber = classNumber, IsAlgebraClass = geomClass.IsAlgebraClass, ProblemNum = geomClass.ProblemNum, TheoryUrl = geomClass.TheoryUrl, TopicClassCount = topicClassCount, TopicName = topicName }); break; } } return Ok(new GetUpcomingClassesResponseDto { UpcomingClasses = upcomingClasses }); } /// <summary> /// Endpoind used to get recommended practice topic for the authenticated user. /// </summary> /// <returns>Recommended practice topic.</returns> [HttpGet] [Route("practice/recommended")] public IActionResult GetRecommendedPracticeTopic() { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var userMistakes = _academaticaDbContext.UserTopicMistakes.Where(x => x.UserId.ToString() == userId).AsEnumerable().OrderByDescending(x => x.MistakeCount); if (userMistakes.Count() == 0) { var userCompletedTopics = _academaticaDbContext.UserTopic.Where(x => x.UserId.ToString() == userId).AsEnumerable(); if (userCompletedTopics.Count() == 0) { return Ok(new GetRecommendedPracticeTopicResponseDto() { RecommendedTopic = null }); } var randomTopicId = userCompletedTopics.OrderBy(x => Guid.NewGuid()).Select(x => x.TopicId).Take(1).SingleOrDefault(); var topic = _academaticaDbContext.Topics.Where(x => x.Id == randomTopicId).FirstOrDefault(); if (topic == null) { return Ok(new GetRecommendedPracticeTopicResponseDto() { RecommendedTopic = null }); } return Ok(new GetRecommendedPracticeTopicResponseDto() { RecommendedTopic = topic == null ? null : new TopicDto() { Description = topic.Description, Id = topic.Id, ImageUrl = topic.ImageUrl, IsAlgebraTopic = topic.IsAlgebraTopic, Name = topic.Name } }); } var topicId = userMistakes.Select(x => x.TopicId).First(); var recommendedTopic = _academaticaDbContext.Topics.Where(x => x.Id == topicId).FirstOrDefault(); if (recommendedTopic == null) { return Ok(new GetRecommendedPracticeTopicResponseDto() { RecommendedTopic = null }); } return Ok(new GetRecommendedPracticeTopicResponseDto() { RecommendedTopic = recommendedTopic == null ? null : new TopicDto() { Description = recommendedTopic.Description, Id = recommendedTopic.Id, ImageUrl = recommendedTopic.ImageUrl, IsAlgebraTopic = recommendedTopic.IsAlgebraTopic, Name = recommendedTopic.Name } }); } /// <summary> /// Endpoind used to get completed topics for the authenticated user. /// </summary> /// <returns>Completed topics.</returns> [HttpGet] [Route("topics/completed")] public IActionResult GetCompletedTopics() { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var completedTopics = _academaticaDbContext.UserTopic.Where(x => x.UserId.ToString() == userId).Join(_academaticaDbContext.Topics, ut => ut.TopicId, t => t.Id, (ut, t) => t).AsEnumerable(); return Ok(new GetCompletedTopicsResponseDto() { Topics = completedTopics }); } /// <summary> /// Endpoind used to get class information for given class ID and authenticated user. /// </summary> /// <param name="id">Class ID.</param> /// <returns>Class information.</returns> [HttpGet] [Route("classes/{id}")] public IActionResult GetClass(string id) { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var classFound = _academaticaDbContext.Classes.Where(x => x.Id == id).FirstOrDefault(); if (classFound == null) { return NotFound($"No class with ID {id} was found."); } var userClassStats = _academaticaDbContext.UserClasses.Where(x => x.UserId == user.Id); var classIsComplete = userClassStats.Where(x => x.ClassId == classFound.Id).Any(); var classFoundIdTokens = classFound.Id.Split("-"); var classFoundTopicId = classFoundIdTokens[0] + "-" + classFoundIdTokens[1]; var classTopic = _academaticaDbContext.Topics.Where(x => x.Id == classFoundTopicId).FirstOrDefault(); var topicName = classTopic == null ? null : classTopic.Name; var classNum = int.Parse(classFoundIdTokens[2]); var sameTypeClasses = _academaticaDbContext.Classes .Where(x => x.IsAlgebraClass == classFound.IsAlgebraClass).ToList(); var completedSameTypeClasses = sameTypeClasses.Join(_academaticaDbContext.UserClasses, c => c.Id, uc => uc.ClassId, (c, uc) => c).AsEnumerable(); var isUnlocked = false; var classIndex = sameTypeClasses.IndexOf(classFound); if (classIndex == 0) { isUnlocked = true; } else { isUnlocked = completedSameTypeClasses.Contains(sameTypeClasses.ElementAt(classIndex - 1)); } return Ok(new GetClassForUserResponseDto() { Id = classFound.Id, Name = classFound.Name, Description = classFound.Description, IsComplete = classIsComplete, ImageUrl = classFound.ImageUrl, ProblemNum = classFound.ProblemNum, TheoryUrl = classFound.TheoryUrl, TopicName = topicName, IsUnlocked = isUnlocked }); } /// <summary> /// Endpoint used to get user activity for the authenticated user. /// </summary> /// <returns>User activity data.</returns> [HttpGet] [Route("activity")] public IActionResult GetUserActivity() { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var activityMatrix = new Dictionary<DateTime, int>(); var day = DateTime.Today; for (int diff = 0; diff < 365; diff++) { var completedClasses = _academaticaDbContext.UserClasses.Where(x => x.UserId.ToString() == userId && x.CompletedAt.Date == day.AddDays(-1 * diff).Date).Count(); activityMatrix.Add(day.AddDays(-1 * diff).Date, completedClasses); } return Ok(new GetUserActivityResponseDto() { ActivityMatrix = activityMatrix }); } /// <summary> /// Endpoint used to get random problems for given class ID. /// </summary> /// <param name="id">Class ID.</param> /// <returns>Problem list.</returns> [HttpGet] [Route("classes/{id}/problems")] public IActionResult GetProblemsForClass(string id) { if (String.IsNullOrEmpty(id)) { return BadRequest("Invalid class ID"); } Regex classIdFormat = new Regex(@"^[0-9]+-[0-1]:[0-9]+-[0-9]+$"); var idIsValid = classIdFormat.IsMatch(id); if (!idIsValid) { return BadRequest("Invalid class ID"); } var classFound = _academaticaDbContext.Classes.Where(x => x.Id == id).FirstOrDefault(); if (classFound == null) { return NotFound($"Class with ID {id} was not found."); } var problemList = _academaticaDbContext.Problems.Where(x => x.ClassId == id).AsEnumerable().OrderBy(x => Guid.NewGuid()).Take((int)classFound.ProblemNum); return Ok(new GetClassProblemsResponseDto() { Problems = problemList.Select(x => new ProblemDto() { Id = x.Id, ClassId = x.ClassId, TopicId = x.TopicId, CorrectAnswers = x.CorrectAnswers, Description = x.Description, Difficulty = x.Difficulty, Expression = x.Expression, ImageUrl = x.ImageUrl, Options = x.Options, ProblemType = x.ProblemType, Task = x.Task }) }); } /// <summary> /// Endpoint used to get problems for custom practice with given parameters. /// </summary> /// <param name="problemsRequestDto">Custom practice problem request parameters.</param> /// <returns>Custom practice problem list.</returns> [HttpPost] [Route("practice/custom/problems")] public IActionResult GetCustomPracticeProblems(GetCustomPracticeProblemsRequestDto problemsRequestDto) { if (ModelState.IsValid) { Regex topicIdFormat = new Regex(@"^[0-9]+-[0-1]:[0-9]+$"); if (problemsRequestDto.TopicData.Count() == 0 || problemsRequestDto.TopicData == null) { return BadRequest("Topic data container no entries"); } var problems = new List<ProblemDto>(); foreach (var entry in problemsRequestDto.TopicData) { var idIsValid = topicIdFormat.IsMatch(entry.Key); if (!idIsValid) { return BadRequest($"Invalid topic ID {entry.Key}."); } if (entry.Value == null) { return BadRequest($"Invalid topic ID {entry.Key} data."); } var foundTopic = _academaticaDbContext.Topics.Where(x => x.Id == entry.Key).FirstOrDefault(); if (foundTopic == null) { return BadRequest($"Invalid topic ID {entry.Key}."); } var topicProblems = _academaticaDbContext.Problems .Where(x => x.TopicId == foundTopic.Id && x.Difficulty == entry.Value.Difficulty) .AsEnumerable().OrderBy(x => Guid.NewGuid()).Take(entry.Value.Count); problems.AddRange(topicProblems.Select(x => new ProblemDto() { Id = x.Id, ClassId = x.ClassId, TopicId = x.TopicId, CorrectAnswers = x.CorrectAnswers, Description = x.Description, Difficulty = x.Difficulty, Expression = x.Expression, ImageUrl = x.ImageUrl, Options = x.Options, ProblemType = x.ProblemType, Task = x.Task })); } return Ok(new GetCustomPracticeProblemsResponseDto() { Problems = problems }); } else { var message = string.Join(" | ", ModelState.Values .SelectMany(v => v.Errors) .Select(e => e.ErrorMessage)); return BadRequest(message); } } /// <summary> /// Endpoint used to get problems for completed topics practice. /// </summary> /// <returns>Problems list.</returns> [HttpGet] [Route("practice/completed/problems")] public IActionResult GetRandomPracticeProblems() { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var completedTopicsIds = _academaticaDbContext.Topics.Join(_academaticaDbContext.UserTopic.Where(x => x.UserId.ToString() == userId), t => t.Id, ut => ut.TopicId, (t, ut) => t.Id).AsEnumerable(); var randomProblems = _academaticaDbContext.Problems.Where(x => completedTopicsIds.Contains(x.TopicId)).AsEnumerable().OrderBy(x => Guid.NewGuid()).Take(10); return Ok(new GetRandomPracticeProblemsResponseDto() { Problems = randomProblems.Select(x => new ProblemDto() { Id = x.Id, ClassId = x.ClassId, TopicId = x.TopicId, CorrectAnswers = x.CorrectAnswers, Description = x.Description, Difficulty = x.Difficulty, Expression = x.Expression, ImageUrl = x.ImageUrl, Options = x.Options, ProblemType = x.ProblemType, Task = x.Task }) }); } /// <summary> /// Endpoint used to get problems for a topic practice. /// </summary> /// <returns>Problems list.</returns> [HttpGet] [Route("practice/topic/problems")] public IActionResult GetTopicPracticeProblems([FromQuery] string topicId) { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var topic = _academaticaDbContext.Topics.Where(x => x.Id == topicId).FirstOrDefault(); if (topic == null) { return NotFound("Invalid topic ID."); } var randomProblems = _academaticaDbContext.Problems.Where(x => x.TopicId == topicId).AsEnumerable().OrderBy(x => Guid.NewGuid()).Take(10); return Ok(new GetTopicPracticeProblemsResponseDto() { Problems = randomProblems.Select(x => new ProblemDto() { Id = x.Id, ClassId = x.ClassId, TopicId = x.TopicId, CorrectAnswers = x.CorrectAnswers, Description = x.Description, Difficulty = x.Difficulty, Expression = x.Expression, ImageUrl = x.ImageUrl, Options = x.Options, ProblemType = x.ProblemType, Task = x.Task }) }); } /// <summary> /// Endpoint used to finish the class with given ID (or practice of a class with given ID) for authenticated user. /// </summary> /// <param name="classId">Class ID.</param> /// <param name="finishClassDto">Class finish params - amount of mistakes.</param> /// <returns>Action result with received exp and achievements.</returns> [HttpPost] [Route("classes/{classId}/finish")] public async Task<IActionResult> FinishClassForUser(string classId, [FromBody] FinishClassForUserRequestDto finishClassDto) { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var finishedClass = _academaticaDbContext.Classes.Where(x => x.Id == classId).FirstOrDefault(); if (finishedClass == null) { return NotFound("Invalid class ID."); } var userCompletedClasses = _academaticaDbContext.UserClasses.Where(x => x.UserId == user.Id).AsEnumerable(); if (userCompletedClasses.Select(x => x.ClassId).Contains(finishedClass.Id)) { var stats = _academaticaDbContext.UserStats.Where(x => x.UserId == user.Id).FirstOrDefault(); if (stats != null) { stats.UserExp += stats.UserExp + 50 <= 15000 ? (ulong)50 : 0; stats.UserExpThisWeek += 50; ExpChangePublishDto expChangePublishDto = new ExpChangePublishDto() { UserId = user.Id, ExpThisWeek = stats.UserExpThisWeek, Event = "EXP_CHANGE" }; _messageBusClient.PublishExpChange(expChangePublishDto); } await _academaticaDbContext.SaveChangesAsync(); return Ok(new FinishClassResponseDto() { Exp = 50, Achievements = new List<AchievementDto>() }); } await _academaticaDbContext.UserClasses.AddAsync(new UserClass() { Class = finishedClass, ClassId = classId, CompletedAt = DateTime.UtcNow, User = user, UserId = user.Id }); var finishedClassTopic = _academaticaDbContext.Topics.Where(x => x.Id == finishedClass.TopicId).FirstOrDefault(); if (finishedClassTopic == null) { return NotFound("Invalid class topic."); } var userTopicMistakes = _academaticaDbContext.UserTopicMistakes.Where(x => x.TopicId == finishedClass.TopicId).FirstOrDefault(); if (userTopicMistakes == null) { await _academaticaDbContext.UserTopicMistakes.AddAsync(new UserTopicMistake() { User = user, UserId = user.Id, MistakeCount = (ulong)finishClassDto.MistakeCount, Topic = finishedClassTopic, TopicId = finishedClassTopic.Id }); } else { userTopicMistakes.MistakeCount += (ulong)finishClassDto.MistakeCount; } var topicClassesIds = _academaticaDbContext.Classes.Where(x => x.TopicId == finishedClass.TopicId).Select(x => x.Id).ToList(); var completedTopicClassesIds = _academaticaDbContext.UserClasses.Where(x => topicClassesIds.Contains(x.ClassId) && x.UserId.ToString() == userId).Select(x => x.ClassId).ToList(); completedTopicClassesIds.Add(classId); if (Enumerable.SequenceEqual(topicClassesIds, completedTopicClassesIds)) { await _academaticaDbContext.UserTopic.AddAsync(new UserTopic() { User = user, UserId = user.Id, CompletedAt = DateTime.UtcNow, Topic = finishedClassTopic, TopicId = finishedClassTopic.Id }); var tier = _academaticaDbContext.Tiers.Where(x => x.Id == finishedClassTopic.TierId).FirstOrDefault(); if (tier != null) { var tierTopicsIds = _academaticaDbContext.Topics.Where(x => x.TierId == finishedClassTopic.TierId).Select(x => x.Id).ToList(); var completedTierTopicsIds = _academaticaDbContext.UserTopic.Where(x => tierTopicsIds.Contains(x.TopicId)).Select(x => x.TopicId).ToList(); completedTierTopicsIds.Add(finishedClassTopic.Id); if (Enumerable.SequenceEqual(tierTopicsIds, completedTierTopicsIds)) { await _academaticaDbContext.UserTier.AddAsync(new UserTier() { User = user, UserId = user.Id, CompletedAt = DateTime.UtcNow, Tier = tier, TierId = tier.Id }); } } } var statsEntry = _academaticaDbContext.UserStats.Where(x => x.UserId == user.Id).FirstOrDefault(); if (statsEntry != null) { statsEntry.UserExp += statsEntry.UserExp + finishedClass.ExpReward <= 15000 ? finishedClass.ExpReward : 0; statsEntry.UserExpThisWeek += finishedClass.ExpReward; ExpChangePublishDto expChangePublishDto = new ExpChangePublishDto() { UserId = user.Id, ExpThisWeek = statsEntry.UserExpThisWeek, Event = "EXP_CHANGE" }; _messageBusClient.PublishExpChange(expChangePublishDto); } await _academaticaDbContext.SaveChangesAsync(); var receivedAchievements = _practiceAchievementsDataClient.GetPracticeAchievements(user.Id, classId, finishClassDto.MistakeCount); return Ok(new FinishClassResponseDto() { Exp = (int)finishedClass.ExpReward, Achievements = receivedAchievements }); } /// <summary> /// Endpoint used to finish the practice for authenticated user. /// </summary> /// <param name="finishPracticeDto">Practice finish params - amount of mistakes.</param> /// <returns>Action result with received exp and achievements.</returns> [HttpPost] [Route("practice/finish")] public async Task<IActionResult> FinishPracticeForUser([FromBody] FinishPracticeForUserRequestDto finishPracticeDto) { if (ModelState.IsValid) { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var buoyAdded = false; var statsEntry = _academaticaDbContext.UserStats.Where(x => x.UserId == user.Id).FirstOrDefault(); if (statsEntry != null) { statsEntry.UserExp += statsEntry.UserExp + 50 <= 15000 ? 50u : 0; statsEntry.UserExpThisWeek += 50u; ExpChangePublishDto expChangePublishDto = new ExpChangePublishDto() { UserId = user.Id, ExpThisWeek = statsEntry.UserExpThisWeek, Event = "EXP_CHANGE" }; _messageBusClient.PublishExpChange(expChangePublishDto); if (statsEntry.BuoysLeft < 5 && !finishPracticeDto.IsCustomPractice) { buoyAdded = true; statsEntry.BuoysLeft++; } } var topicId = finishPracticeDto.TopicId; if (!string.IsNullOrEmpty(finishPracticeDto.ClassId)) { var practiceClass = _academaticaDbContext.Classes.Where(x => x.Id == finishPracticeDto.ClassId).FirstOrDefault(); if (practiceClass != null) { topicId = practiceClass.TopicId; } } if (!string.IsNullOrEmpty(finishPracticeDto.TopicId)) { var finishedPracticeTopic = _academaticaDbContext.Topics.Where(x => x.Id == finishPracticeDto.TopicId).FirstOrDefault(); if (finishedPracticeTopic == null) { return NotFound("Invalid class topic."); } var userTopicMistakes = _academaticaDbContext.UserTopicMistakes.Where(x => x.TopicId == finishedPracticeTopic.Id).FirstOrDefault(); if (userTopicMistakes != null) { userTopicMistakes.MistakeCount = (ulong)finishPracticeDto.MistakeCount; } } await _academaticaDbContext.SaveChangesAsync(); return Ok(new FinishPracticeResponseDto() { Exp = 50, BuoyAdded = buoyAdded }); } else { var message = string.Join(" | ", ModelState.Values .SelectMany(v => v.Errors) .Select(e => e.ErrorMessage)); return BadRequest(message); } } /// <summary> /// Endpoint used to get tiers info for authenticated user. /// </summary> /// <returns>Tier list.</returns> [HttpGet] [Route("tiers")] public IActionResult GetTiersForUser() { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } List<GetTierForUserResponseDto> tiers = new List<GetTierForUserResponseDto>(); var tiersList = _academaticaDbContext.Tiers.AsEnumerable().OrderBy(x => x.Id, new TierIdComparer()); for (int i = 0; i < tiersList.Count(); ++i) { var tier = tiersList.ElementAt(i); var tierTopicsIds = _academaticaDbContext.Topics.Where(x => x.TierId == tier.Id).Select(x => x.Id).ToList(); var completedTierTopicsIds = _academaticaDbContext.UserTopic.Where(x => tierTopicsIds.Contains(x.TopicId) && x.UserId == user.Id).Select(x => x.TopicId).ToList(); var tierIsComplete = _academaticaDbContext.UserTier.Where(x => x.UserId.ToString() == userId) .Select(x => x.TierId).Contains(tier.Id); var tierIsUnlocked = false; if (i == 0) { tierIsUnlocked = true; } else { tierIsUnlocked = _academaticaDbContext.UserTier.Where(x => x.UserId.ToString() == userId) .Select(x => x.TierId).Contains(tiersList.ElementAt(i - 1).Id); } tiers.Add(new GetTierForUserResponseDto() { Id = tier.Id, Name = tier.Name, Description = tier.Description, CompletionRate = (int)((double)completedTierTopicsIds.Count / tierTopicsIds.Count * 100), IsComplete = tierIsComplete, IsUnlocked = tierIsUnlocked }); } return Ok(new GetTiersForUserResponseDto() { Tiers = tiers }); } /// <summary> /// Endpoint used to get topic info for authenticated user in the given tier. /// </summary> /// <param name="id">Tier ID.</param> /// <returns>Topic list.</returns> [HttpGet] [Route("tiers/{id}")] public IActionResult GetTopicsForUser(string id) { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var tier = _academaticaDbContext.Tiers.Where(x => x.Id == id).FirstOrDefault(); if (tier == null) { return NotFound("Invalid tier ID"); } List<GetTopicForUserResponseDto> topics = new List<GetTopicForUserResponseDto>(); var topicsList = _academaticaDbContext.Topics.Where(x => x.TierId == id).AsEnumerable().OrderBy(x => x.Id, new TopicIdComparer()); var algebraTopicsIds = _academaticaDbContext.Topics.Where(x => x.IsAlgebraTopic).AsEnumerable().OrderBy(x => x.Id, new TopicIdComparer()).Select(x => x.Id).ToList(); var geometryTopicsIds = _academaticaDbContext.Topics.Where(x => !x.IsAlgebraTopic).AsEnumerable().OrderBy(x => x.Id, new TopicIdComparer()).Select(x => x.Id).ToList(); foreach (var entry in algebraTopicsIds) { Console.WriteLine(entry); } Console.WriteLine(); foreach (var entry in geometryTopicsIds) { Console.WriteLine(entry); } for (int i = 0; i < topicsList.Count(); ++i) { var topicClassesIds = _academaticaDbContext.Classes.Where(x => x.TopicId == topicsList.ElementAt(i).Id).Select(x => x.Id).ToList(); var completedTopicClassesIds = _academaticaDbContext.UserClasses.Where(x => topicClassesIds.Contains(x.ClassId) && x.UserId == user.Id) .Select(x => x.ClassId).ToList(); var topicIsComplete = _academaticaDbContext.UserTopic.Where(x => x.UserId.ToString() == userId) .Select(x => x.TopicId).Contains(topicsList.ElementAt(i).Id); var topicIsUnlocked = false; var isAlgebraTopic = topicsList.ElementAt(i).IsAlgebraTopic; var elementId = 0; if (isAlgebraTopic) { elementId = algebraTopicsIds.IndexOf(topicsList.ElementAt(i).Id); if (elementId == 0) { topicIsUnlocked = true; } else { topicIsUnlocked = _academaticaDbContext.UserTopic.Where(x => x.UserId.ToString() == userId) .Select(x => x.TopicId).Contains(algebraTopicsIds[elementId - 1]); } } else { elementId = geometryTopicsIds.IndexOf(topicsList.ElementAt(i).Id); if (elementId == 0) { topicIsUnlocked = true; } else { topicIsUnlocked = _academaticaDbContext.UserTopic.Where(x => x.UserId.ToString() == userId) .Select(x => x.TopicId).Contains(geometryTopicsIds[elementId - 1]); } } topics.Add(new GetTopicForUserResponseDto() { Id = topicsList.ElementAt(i).Id, Name = topicsList.ElementAt(i).Name, Description = topicsList.ElementAt(i).Description, ImageUrl = topicsList.ElementAt(i).ImageUrl, IsAlgebraTopic = topicsList.ElementAt(i).IsAlgebraTopic, CompletionRate = topicClassesIds.Count == 0 ? 0 : (int)(((double)completedTopicClassesIds.Count) / topicClassesIds.Count * 100), IsComplete = topicIsComplete, IsUnlocked = topicIsUnlocked, ClassCount = topicClassesIds.Count }); } return Ok(new GetTopicsForUserResponseDto() { Topics = topics }); } /// <summary> /// Endpoint used to get classes info for authenticated user in the given tier and given topic. /// </summary> /// <param name="topicId">Topic ID.</param> /// <returns>Topic list.</returns> [HttpGet] [Route("topics/{topicId}")] public IActionResult GetClassesForUser(string topicId) { var userId = User.FindFirst("sub")?.Value; if (string.IsNullOrEmpty(userId)) { return BadRequest("User ID was null."); } var user = _academaticaDbContext.Users.Where(x => x.Id.ToString() == userId).FirstOrDefault(); if (user == null) { return NotFound("Invalid user ID."); } var topic = _academaticaDbContext.Topics.Where(x => x.Id == topicId).FirstOrDefault(); if (topic == null) { return NotFound("Invalid topic ID"); } List<GetClassForUserResponseDto> classes = new List<GetClassForUserResponseDto>(); var classesList = _academaticaDbContext.Classes.Where(x => x.TopicId == topicId).AsEnumerable().OrderBy(x => x.Id, new ClassIdComparer()); for (int i = 0; i < classesList.Count(); ++i) { var currentClass = classesList.ElementAt(i); var classIsComplete = _academaticaDbContext.UserClasses.Where(x => x.UserId.ToString() == userId) .Select(x => x.ClassId).Contains(currentClass.Id); var classIsUnlocked = false; if (i == 0 || classesList.ElementAt(i - 1).TopicId != currentClass.TopicId) { classIsUnlocked = true; } else { classIsUnlocked = _academaticaDbContext.UserClasses.Where(x => x.UserId.ToString() == userId) .Select(x => x.ClassId).Contains(classesList.ElementAt(i - 1).Id); } classes.Add(new GetClassForUserResponseDto() { Id = currentClass.Id, Name = currentClass.Name, Description = currentClass.Description, IsComplete = classIsComplete, ImageUrl = currentClass.ImageUrl, ProblemNum = currentClass.ProblemNum, TheoryUrl = currentClass.TheoryUrl, TopicName = topic.Name, IsUnlocked = classIsUnlocked }); } return Ok(new GetClassesForUserResponseDto() { Classes = classes }); } } }
39.255009
190
0.511067
[ "MIT" ]
NicNieRobie/academatica-web
Academatica.Api/Academatica.Api.Course/Controllers/CourseController.cs
43,104
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("OnixData")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OnixData")] [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("001b5989-7440-44bb-beed-fe4422e2634e")] // 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.540541
84
0.743701
[ "Apache-2.0" ]
Stanislaw000/ONIX-Data
OnixData/Properties/AssemblyInfo.cs
1,392
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System; using System.ComponentModel; namespace Azure.ResourceManager.Network.Models { /// <summary> The type of the rule collection. </summary> public readonly partial struct FirewallPolicyRuleCollectionType : IEquatable<FirewallPolicyRuleCollectionType> { private readonly string _value; /// <summary> Initializes a new instance of <see cref="FirewallPolicyRuleCollectionType"/>. </summary> /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception> public FirewallPolicyRuleCollectionType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } private const string FirewallPolicyNatRuleCollectionValue = "FirewallPolicyNatRuleCollection"; private const string FirewallPolicyFilterRuleCollectionValue = "FirewallPolicyFilterRuleCollection"; /// <summary> FirewallPolicyNatRuleCollection. </summary> public static FirewallPolicyRuleCollectionType FirewallPolicyNatRuleCollection { get; } = new FirewallPolicyRuleCollectionType(FirewallPolicyNatRuleCollectionValue); /// <summary> FirewallPolicyFilterRuleCollection. </summary> public static FirewallPolicyRuleCollectionType FirewallPolicyFilterRuleCollection { get; } = new FirewallPolicyRuleCollectionType(FirewallPolicyFilterRuleCollectionValue); /// <summary> Determines if two <see cref="FirewallPolicyRuleCollectionType"/> values are the same. </summary> public static bool operator ==(FirewallPolicyRuleCollectionType left, FirewallPolicyRuleCollectionType right) => left.Equals(right); /// <summary> Determines if two <see cref="FirewallPolicyRuleCollectionType"/> values are not the same. </summary> public static bool operator !=(FirewallPolicyRuleCollectionType left, FirewallPolicyRuleCollectionType right) => !left.Equals(right); /// <summary> Converts a string to a <see cref="FirewallPolicyRuleCollectionType"/>. </summary> public static implicit operator FirewallPolicyRuleCollectionType(string value) => new FirewallPolicyRuleCollectionType(value); /// <inheritdoc /> [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is FirewallPolicyRuleCollectionType other && Equals(other); /// <inheritdoc /> public bool Equals(FirewallPolicyRuleCollectionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// <inheritdoc /> [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; /// <inheritdoc /> public override string ToString() => _value; } }
56
179
0.738668
[ "MIT" ]
93mishra/azure-sdk-for-net
sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyRuleCollectionType.cs
2,912
C#
// // Options.cs // // Authors: // Jonathan Pryor <jpryor@novell.com>, <Jonathan.Pryor@microsoft.com> // Federico Di Gregorio <fog@initd.org> // Rolf Bjarne Kvinge <rolf@xamarin.com> // // Copyright (C) 2008 Novell (http://www.novell.com) // Copyright (C) 2009 Federico Di Gregorio. // Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com) // Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com) // // 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. // // Compile With: // mcs -debug+ -r:System.Core Options.cs -o:Mono.Options.dll -t:library // mcs -debug+ -d:LINQ -r:System.Core Options.cs -o:Mono.Options.dll -t:library // // The LINQ version just changes the implementation of // OptionSet.Parse(IEnumerable<string>), and confers no semantic changes. // // A Getopt::Long-inspired option parsing library for C#. // // Mono.Options.OptionSet is built upon a key/value table, where the // key is a option format string and the value is a delegate that is // invoked when the format string is matched. // // Option format strings: // Regex-like BNF Grammar: // name: .+ // type: [=:] // sep: ( [^{}]+ | '{' .+ '}' )? // aliases: ( name type sep ) ( '|' name type sep )* // // Each '|'-delimited name is an alias for the associated action. If the // format string ends in a '=', it has a required value. If the format // string ends in a ':', it has an optional value. If neither '=' or ':' // is present, no value is supported. `=' or `:' need only be defined on one // alias, but if they are provided on more than one they must be consistent. // // Each alias portion may also end with a "key/value separator", which is used // to split option values if the option accepts > 1 value. If not specified, // it defaults to '=' and ':'. If specified, it can be any character except // '{' and '}' OR the *string* between '{' and '}'. If no separator should be // used (i.e. the separate values should be distinct arguments), then "{}" // should be used as the separator. // // Options are extracted either from the current option by looking for // the option name followed by an '=' or ':', or is taken from the // following option IFF: // - The current option does not contain a '=' or a ':' // - The current option requires a value (i.e. not a Option type of ':') // // The `name' used in the option format string does NOT include any leading // option indicator, such as '-', '--', or '/'. All three of these are // permitted/required on any named option. // // Option bundling is permitted so long as: // - '-' is used to start the option group // - all of the bundled options are a single character // - at most one of the bundled options accepts a value, and the value // provided starts from the next character to the end of the string. // // This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value' // as '-Dname=value'. // // Option processing is disabled by specifying "--". All options after "--" // are returned by OptionSet.Parse() unchanged and unprocessed. // // Unprocessed options are returned from OptionSet.Parse(). // // Examples: // int verbose = 0; // OptionSet p = new OptionSet () // .Add ("v", v => ++verbose) // .Add ("name=|value=", v => Console.WriteLine (v)); // p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"}); // // The above would parse the argument string array, and would invoke the // lambda expression three times, setting `verbose' to 3 when complete. // It would also print out "A" and "B" to standard output. // The returned array would contain the string "extra". // // C# 3.0 collection initializers are supported and encouraged: // var p = new OptionSet () { // { "h|?|help", v => ShowHelp () }, // }; // // System.ComponentModel.TypeConverter is also supported, allowing the use of // custom data types in the callback type; TypeConverter.ConvertFromString() // is used to convert the value option to an instance of the specified // type: // // var p = new OptionSet () { // { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) }, // }; // // Random other tidbits: // - Boolean options (those w/o '=' or ':' in the option format string) // are explicitly enabled if they are followed with '+', and explicitly // disabled if they are followed with '-': // string a = null; // var p = new OptionSet () { // { "a", s => a = s }, // }; // p.Parse (new string[]{"-a"}); // sets v != null // p.Parse (new string[]{"-a+"}); // sets v != null // p.Parse (new string[]{"-a-"}); // sets v is null // // // Mono.Options.CommandSet allows easily having separate commands and // associated command options, allowing creation of a *suite* along the // lines of **git**(1), **svn**(1), etc. // // CommandSet allows intermixing plain text strings for `--help` output, // Option values -- as supported by OptionSet -- and Command instances, // which have a name, optional help text, and an optional OptionSet. // // var suite = new CommandSet ("suite-name") { // // Use strings and option values, as with OptionSet // "usage: suite-name COMMAND [OPTIONS]+", // { "v:", "verbosity", (int? v) => Verbosity = v.HasValue ? v.Value : Verbosity+1 }, // // Commands may also be specified // new Command ("command-name", "command help") { // Options = new OptionSet {/*...*/}, // Run = args => { /*...*/}, // }, // new MyCommandSubclass (), // }; // return suite.Run (new string[]{...}); // // CommandSet provides a `help` command, and forwards `help COMMAND` // to the registered Command instance by invoking Command.Invoke() // with `--help` as an option. // using System; using System.Collections; using System.Collections.Generic; using System.Text; namespace Mono.Options { public class OptionValueCollection : IList, IList<string> { public OptionValueCollection(OptionContext c) { C = c; } bool ICollection.IsSynchronized => (Values as ICollection).IsSynchronized; object ICollection.SyncRoot => (Values as ICollection).SyncRoot; public int Count => Values.Count; public bool IsReadOnly => false; bool IList.IsFixedSize => false; public List<string> Values { get; set; } = new List<string>(); public OptionContext C { get; set; } object IList.this[int index] { get => this[index]; set => (Values as IList)[index] = value; } public string this[int index] { get { AssertValid(index); return index >= Values.Count ? null : Values[index]; } set => Values[index] = value; } #region ICollection void ICollection.CopyTo(Array array, int index) { (Values as ICollection).CopyTo(array, index); } #endregion ICollection #region ICollection<T> public void Add(string item) { Values.Add(item); } public void Clear() { Values.Clear(); } public bool Contains(string item) { return Values.Contains(item); } public void CopyTo(string[] array, int arrayIndex) { Values.CopyTo(array, arrayIndex); } public bool Remove(string item) { return Values.Remove(item); } #endregion ICollection<T> #region IEnumerable IEnumerator IEnumerable.GetEnumerator() { return Values.GetEnumerator(); } #endregion IEnumerable #region IEnumerable<T> public IEnumerator<string> GetEnumerator() { return Values.GetEnumerator(); } #endregion IEnumerable<T> #region IList int IList.Add(object value) { return (Values as IList).Add(value); } bool IList.Contains(object value) { return (Values as IList).Contains(value); } int IList.IndexOf(object value) { return (Values as IList).IndexOf(value); } void IList.Insert(int index, object value) { (Values as IList).Insert(index, value); } void IList.Remove(object value) { (Values as IList).Remove(value); } void IList.RemoveAt(int index) { (Values as IList).RemoveAt(index); } #endregion IList #region IList<T> public int IndexOf(string item) { return Values.IndexOf(item); } public void Insert(int index, string item) { Values.Insert(index, item); } public void RemoveAt(int index) { Values.RemoveAt(index); } private void AssertValid(int index) { if (C.Option is null) { throw new InvalidOperationException($"{nameof(OptionContext)}.{nameof(OptionContext.Option)} is null."); } if (index >= C.Option.MaxValueCount) { throw new ArgumentOutOfRangeException(nameof(index)); } if (C.Option.OptionValueType == OptionValueType.Required && index >= Values.Count) { throw new OptionException(string.Format( C.OptionSet.MessageLocalizer($"Missing required value for option '{C.OptionName}'.")), C.OptionName); } } #endregion IList<T> public List<string> ToList() { return new List<string>(Values); } public string[] ToArray() { return Values.ToArray(); } public override string ToString() { return string.Join(", ", Values.ToArray()); } } }
29.270349
108
0.664316
[ "MIT" ]
2pac1/WalletWasabi
WalletWasabi/Mono/OptionValueCollection.cs
10,069
C#
// Copyright 2017 the original author or authors. // // 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; namespace Steeltoe.CloudFoundry.Connector.Relational.SqlServer { /// <summary> /// Assemblies and types used for interacting with Microsoft SQL Server /// </summary> public static class SqlServerTypeLocator { /// <summary> /// List of supported SQL Server Client assemblies /// </summary> public static readonly string[] Assemblies = new string[] { "System.Data.SqlClient" }; /// <summary> /// List of SQL Server types that implement IDbConnection /// </summary> public static readonly string[] ConnectionTypeNames = new string[] { "System.Data.SqlClient.SqlConnection" }; /// <summary> /// Gets SqlConnection from a SQL Server Library /// </summary> /// <exception cref="ConnectorException">When type is not found</exception> public static Type SqlConnection { get { var type = ConnectorHelpers.FindType(Assemblies, ConnectionTypeNames); if (type == null) { throw new ConnectorException("Unable to find SqlConnection, are you missing a Microsoft SQL Server ADO.NET assembly?"); } return type; } } } }
35.962264
139
0.637461
[ "ECL-2.0", "Apache-2.0" ]
ianroof/Connectors
src/Steeltoe.CloudFoundry.ConnectorBase/Relational/SqlServer/SqlServerTypeLocator.cs
1,908
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.Collections.Generic; namespace Microsoft.AspNet.Http { public interface IFormFileCollection : IReadOnlyList<IFormFile> { IFormFile this[string name] { get; } IFormFile GetFile(string name); IReadOnlyList<IFormFile> GetFiles(string name); } }
28.8125
111
0.722343
[ "Apache-2.0" ]
sebnema/HttpAbstractions-1.0.0-rc1-NoAuthHandler
src/Microsoft.AspNet.Http.Abstractions/IFormFileCollection.cs
461
C#
// ============================================================================== // // RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License // // Copyright 2007-2008 The Apache Software Foundation. // // 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. // ============================================================================== namespace MinecraftLauncher { using System.Collections.Concurrent; using LoggingExtensions.Logging; /// <summary> /// Extensions to help make logging awesome - this should be installed into the root namespace of your application /// </summary> public static class LogExtensions { /// <summary> /// Concurrent dictionary that ensures only one instance of a logger for a type. /// </summary> private static readonly ConcurrentDictionary<string, ILog> _dictionary = new ConcurrentDictionary<string, ILog>(); /// <summary> /// Gets the logger for <see cref="T"/>. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="type">The type to get the logger for.</param> /// <returns>Instance of a logger for the object.</returns> public static ILog Log<T>(this T type) { string objectName = typeof (T).FullName; return Log(objectName); } /// <summary> /// Gets the logger for the specified object name. /// </summary> /// <param name="objectName">Either use the fully qualified object name or the short. If used with Log&lt;T&gt;() you must use the fully qualified object name"/></param> /// <returns>Instance of a logger for the object.</returns> public static ILog Log(this string objectName) { return _dictionary.GetOrAdd(objectName, LoggingExtensions.Logging.Log.GetLoggerFor); } } }
44.285714
178
0.600403
[ "MIT" ]
Sergeeeek/MinecraftLauncher
MinecraftLauncher/LogExtensions.cs
2,481
C#
using System.Collections.Immutable; using System.Text.RegularExpressions; using Microsoft.Recognizers.Definitions.German; using Microsoft.Recognizers.Text.Number; namespace Microsoft.Recognizers.Text.DateTime.German { public class GermanDurationExtractorConfiguration : BaseDateTimeOptionsConfiguration, IDurationExtractorConfiguration { public static readonly Regex DurationUnitRegex = new Regex(DateTimeDefinitions.DurationUnitRegex, RegexFlags); public static readonly Regex SuffixAndRegex = new Regex(DateTimeDefinitions.SuffixAndRegex, RegexFlags); public static readonly Regex DurationFollowedUnit = new Regex(DateTimeDefinitions.DurationFollowedUnit, RegexFlags); public static readonly Regex NumberCombinedWithDurationUnit = new Regex(DateTimeDefinitions.NumberCombinedWithDurationUnit, RegexFlags); public static readonly Regex AnUnitRegex = new Regex(DateTimeDefinitions.AnUnitRegex, RegexFlags); public static readonly Regex DuringRegex = new Regex(DateTimeDefinitions.DuringRegex, RegexFlags); public static readonly Regex AllRegex = new Regex(DateTimeDefinitions.AllRegex, RegexFlags); public static readonly Regex HalfRegex = new Regex(DateTimeDefinitions.HalfRegex, RegexFlags); public static readonly Regex ConjunctionRegex = new Regex(DateTimeDefinitions.ConjunctionRegex, RegexFlags); public static readonly Regex InexactNumberRegex = new Regex(DateTimeDefinitions.InexactNumberRegex, RegexFlags); public static readonly Regex InexactNumberUnitRegex = new Regex(DateTimeDefinitions.InexactNumberUnitRegex, RegexFlags); public static readonly Regex RelativeDurationUnitRegex = new Regex(DateTimeDefinitions.RelativeDurationUnitRegex, RegexFlags); public static readonly Regex DurationConnectorRegex = new Regex(DateTimeDefinitions.DurationConnectorRegex, RegexFlags); public static readonly Regex ModPrefixRegex = new Regex(DateTimeDefinitions.ModPrefixRegex, RegexFlags); public static readonly Regex ModSuffixRegex = new Regex(DateTimeDefinitions.ModSuffixRegex, RegexFlags); public static readonly Regex SpecialNumberUnitRegex = new Regex(DateTimeDefinitions.SpecialNumberUnitRegex, RegexFlags); public static readonly Regex MoreThanRegex = new Regex(DateTimeDefinitions.MoreThanRegex, RegexFlags); public static readonly Regex LessThanRegex = new Regex(DateTimeDefinitions.LessThanRegex, RegexFlags); private const RegexOptions RegexFlags = RegexOptions.Singleline | RegexOptions.ExplicitCapture; public GermanDurationExtractorConfiguration(IDateTimeOptionsConfiguration config) : base(config) { var numOptions = NumberOptions.None; if ((config.Options & DateTimeOptions.NoProtoCache) != 0) { numOptions = NumberOptions.NoProtoCache; } var numConfig = new BaseNumberOptionsConfiguration(config.Culture, numOptions); CardinalExtractor = Number.German.NumberExtractor.GetInstance(numConfig); UnitMap = DateTimeDefinitions.UnitMap.ToImmutableDictionary(); UnitValueMap = DateTimeDefinitions.UnitValueMap.ToImmutableDictionary(); } public IExtractor CardinalExtractor { get; } public IImmutableDictionary<string, string> UnitMap { get; } public IImmutableDictionary<string, long> UnitValueMap { get; } bool IDurationExtractorConfiguration.CheckBothBeforeAfter => DateTimeDefinitions.CheckBothBeforeAfter; Regex IDurationExtractorConfiguration.FollowedUnit => DurationFollowedUnit; Regex IDurationExtractorConfiguration.NumberCombinedWithUnit => NumberCombinedWithDurationUnit; Regex IDurationExtractorConfiguration.AnUnitRegex => AnUnitRegex; Regex IDurationExtractorConfiguration.DuringRegex => DuringRegex; Regex IDurationExtractorConfiguration.AllRegex => AllRegex; Regex IDurationExtractorConfiguration.HalfRegex => HalfRegex; Regex IDurationExtractorConfiguration.SuffixAndRegex => SuffixAndRegex; Regex IDurationExtractorConfiguration.ConjunctionRegex => ConjunctionRegex; Regex IDurationExtractorConfiguration.InexactNumberRegex => InexactNumberRegex; Regex IDurationExtractorConfiguration.InexactNumberUnitRegex => InexactNumberUnitRegex; Regex IDurationExtractorConfiguration.RelativeDurationUnitRegex => RelativeDurationUnitRegex; Regex IDurationExtractorConfiguration.DurationUnitRegex => DurationUnitRegex; Regex IDurationExtractorConfiguration.DurationConnectorRegex => DurationConnectorRegex; Regex IDurationExtractorConfiguration.SpecialNumberUnitRegex => SpecialNumberUnitRegex; Regex IDurationExtractorConfiguration.MoreThanRegex => MoreThanRegex; Regex IDurationExtractorConfiguration.LessThanRegex => LessThanRegex; Regex IDurationExtractorConfiguration.ModPrefixRegex => ModPrefixRegex; Regex IDurationExtractorConfiguration.ModSuffixRegex => ModSuffixRegex; } }
41.796875
121
0.747477
[ "MIT" ]
QPC-database/Recognizers-Text
.NET/Microsoft.Recognizers.Text.DateTime/German/Extractors/GermanDurationExtractorConfiguration.cs
5,352
C#
using Microsoft.ServiceBus.Messaging; using Octgn.Site.Api.Models; using System; using System.Linq; namespace Gap.Modules { public class WebhookModule : Module, IRunnableModule { private static log4net.ILog Log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType ); public string AzureServiceBusWebhookQueue { get; set; } private QueueClient _client; public void Start() { if( _client != null ) return; Log.Info( "Starting WebhookModule" ); Log.Info( "Connection String: " + AzureServiceBusWebhookQueue ); _client = QueueClient.CreateFromConnectionString( AzureServiceBusWebhookQueue ); var opts = new OnMessageOptions() { AutoComplete = false, }; _client.OnMessage( ProcessMessage, opts ); } public void Stop() { if( _client == null ) return; Log.Info( "Stopping WebhookModule" ); _client?.Close(); _client = null; } private void ProcessMessage( BrokeredMessage bmess ) { try { using( bmess ) { var message = bmess.GetBody<WebhookQueueMessage>(); var endmessage = WebhookParser.Parse( message ); var parsed = true; if( endmessage == null ) { var parser = WebhookParser.Get( message ); if( parser == null ) { Log.Error( "Could not find parser for message\n" + message.Body ); endmessage = "Could not find parser for message"; } else { Log.Error( parser.GetType().Name + " failed to parse\n" + message.Body ); if( parser.GetType() == typeof( GithubWebhookParser ) ) { endmessage = parser.GetType().Name + " failed to parse message of event type: " + message.Headers["X-GitHub-Event"].First(); } else { endmessage = parser.GetType().Name + " failed to parse message"; } } parsed = false; } if( endmessage != "IGNORE" ) { var messageItem = new MessageItem( "gap", endmessage ); switch( message.Endpoint ) { case WebhookEndpoint.Octgn: Inputs["WebhookOctgn"].Push( this, messageItem ); break; case WebhookEndpoint.OctgnDev: Inputs["WebhookOctgnDev"].Push( this, messageItem ); break; case WebhookEndpoint.OctgnLobby: Inputs["WebhookOctgnLobby"].Push( this, messageItem ); break; default: throw new ArgumentOutOfRangeException( message.Endpoint.ToString() ); } } if( parsed ) { bmess.Complete(); } } } catch( Exception e ) { Log.Error( "ProcessHooksTimerOnElapsed", e ); } } protected override void Dispose( bool disposing ) { base.Dispose( disposing ); if( !disposing ) return; Stop(); } } }
41.3
136
0.463008
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
octgn/Gap
Gap/Modules/WebhookModule.cs
3,719
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Dapper.Data.Repositories.Interface; namespace Dapper.Data { public class DbContext : IDbContext { public IEmployeeRepository Employee { get; } public IDb Db { get; } public DbContext(IEmployeeRepository employeeRepository,IDb db) { Employee = employeeRepository; Db = db; } } }
22.173913
72
0.621569
[ "Apache-2.0" ]
pankaj0567/LearningDapper
Dapper.Data/DbContext.cs
512
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; // INotifyPropertyChanged using System.ComponentModel; // Brushes using System.Windows.Media; namespace BrickBreakergame { public partial class Model : INotifyPropertyChanged { private double _ballCanvasTop; public double ballCanvasTop { get { return _ballCanvasTop; } set { _ballCanvasTop = value; OnPropertyChanged("ballCanvasTop"); } } private double _ballCanvasLeft; public double ballCanvasLeft { get { return _ballCanvasLeft; } set { _ballCanvasLeft = value; OnPropertyChanged("ballCanvasLeft"); } } private double _paddleCanvasTop; public double paddleCanvasTop { get { return _paddleCanvasTop; } set { _paddleCanvasTop = value; OnPropertyChanged("paddleCanvasTop"); } } private double _paddleCanvasLeft; public double paddleCanvasLeft { get { return _paddleCanvasLeft; } set { _paddleCanvasLeft = value; OnPropertyChanged("paddleCanvasLeft"); } } private double _ballHeight; public double BallHeight { get { return _ballHeight; } set { _ballHeight = value; OnPropertyChanged("BallHeight"); } } private double _ballWidth; public double BallWidth { get { return _ballWidth; } set { _ballWidth = value; OnPropertyChanged("BallWidth"); } } private double _paddleHeight; public double paddleHeight { get { return _paddleHeight; } set { _paddleHeight = value; OnPropertyChanged("paddleHeight"); } } private double _paddleWidth; public double paddleWidth { get { return _paddleWidth; } set { _paddleWidth = value; OnPropertyChanged("paddleWidth"); } } } }
23.72381
55
0.496989
[ "Unlicense" ]
luciochen233/CSE483-code
repo/BrickBreakergame/BallPaddle.cs
2,493
C#
using MCPE.AlphaServer.Utils; using System; using System.Collections.Generic; using System.Text; namespace MCPE.AlphaServer.Packets { public class ContainerSetContentPacket : RakPacket { public byte WindowID; public short Count; public byte[] Items; public override byte[] Serialize() => throw new NotImplementedException(); } }
24.8
82
0.706989
[ "MIT" ]
atipls/MCPE.AlphaServer
MCPE.AlphaServer/Packets/Rak/ContainerSetContentPacket.cs
374
C#
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated> using System; using System.Collections.Generic; #nullable disable namespace T0001 { public partial class OutasnDHis { public string Ids { get; set; } public string Id { get; set; } public string Cstatus { get; set; } public string Cinvcode { get; set; } public string Cinvname { get; set; } public decimal? Iquantity { get; set; } public string Cinvbarcode { get; set; } public string Cbatch { get; set; } public string Cerpcodeline { get; set; } public string Cmemo { get; set; } public string Cdefine1 { get; set; } public string Cdefine2 { get; set; } public DateTime? Ddefine3 { get; set; } public DateTime? Ddefine4 { get; set; } public decimal? Idefine5 { get; set; } public string Cso { get; set; } public decimal? Isoline { get; set; } public string Site { get; set; } public decimal? IsSmt { get; set; } } }
35.774194
97
0.585212
[ "MIT" ]
twoutlook/BlazorServerDbContextExample
BlazorServerEFCoreSample/T0001/OutasnDHis.cs
1,111
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 namespace magic_e_Shop.Controllers { public class CCPaymentController : Controller { // GET: /<controller>/ public IActionResult Index() { return View(); } } }
23.05
112
0.683297
[ "MIT" ]
castillocarlosr/magic-e-store
magic-e-Shop/magic-e-Shop/Controllers/CCPaymentController.cs
463
C#
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("LightCutter.Desktop")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LightCutter.Desktop")] [assembly: AssemblyCopyright("Copyright © 2017~2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] //ローカライズ可能なアプリケーションのビルドを開始するには、 //.csproj ファイルの <UICulture>CultureYouAreCodingWith</UICulture> を //<PropertyGroup> 内部で設定します。たとえば、 //ソース ファイルで英語を使用している場合、<UICulture> を en-US に設定します。次に、 //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 //(リソースがページ、 //またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 //(リソースがページ、 //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) )] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("7.1.45.31")] //[assembly: AssemblyFileVersion("1.0.0.0")]
33.464286
100
0.708111
[ "MIT" ]
surviveplus/Light-Cutter
LightCutter/LightCutter.Desktop/Properties/AssemblyInfo.cs
2,969
C#
using System; using System.Collections.Generic; using System.Linq; using Focus.Infrastructure.Common.MongoDB; using Focus.Service.Identity.Application.Services; using Focus.Service.Identity.Core.Entities; using Focus.Service.Identity.Infrastructure.Persistence; using Focus.Service.Identity.Infrastructure.Security; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace Focus.Service.Identity.Infrastructure { public static class CompositionRoot { public static IServiceCollection AddInfrastructure(this IServiceCollection services) { return services .AddScoped<IIdentityRepository, IdentityRepository>() .AddSingleton<IPasswordGenerator, PasswordGenerator>() .AddSingleton<ISecurityTokenGenerator, JwtSecurityTokenGenerator>(); } public static async void SeedAdministrator(this IApplicationBuilder app, string username, string password) { var logger = app.ApplicationServices.GetRequiredService<ILogger<object>>(); var config = app.ApplicationServices.GetRequiredService<IMongoConfiguration>(); logger.LogInformation($"database name : {config.Database}"); var repository = app.ApplicationServices.GetRequiredService<IIdentityRepository>(); try { var orgs = await repository.GetOrganizationsAsync(); if (orgs.Any(o => o.IsHead)) return; var id = await repository.CreateNewOrganizationAsync(new Organization() { Title = "Head Organization", IsHead = true, Members = new List<string>() }); await repository.CreateNewUserAsync( "Admin", "Admin", "Admin", username, password, "HOA", id); } catch (Exception) { throw; } } } }
34.539683
114
0.598805
[ "Apache-2.0" ]
dckntm/focus-backend
src/Focus.Service.Identity/Infrastructure/CompositionRoot.cs
2,176
C#
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ namespace Microsoft.Azure.IIoT.Modules.OpcUa.Twin.v2.Models { using Microsoft.Azure.IIoT.OpcUa.Twin.Models; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; /// <summary> /// Result of attribute reads /// </summary> public class ReadResponseApiModel { /// <summary> /// Default constructor /// </summary> public ReadResponseApiModel() { } /// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public ReadResponseApiModel(ReadResultModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } Results = model.Results? .Select(a => a == null ? null : new AttributeReadResponseApiModel(a)) .ToList(); } /// <summary> /// All results of attribute reads /// </summary> [JsonProperty(PropertyName = "Results")] public List<AttributeReadResponseApiModel> Results { set; get; } } }
32.976744
99
0.535966
[ "MIT" ]
TheWaywardHayward/Industrial-IoT
modules/opc-twin/src/v2/Models/ReadResponseApiModel.cs
1,418
C#
using System; namespace VkNet.Model.RequestParams { /// <summary> /// Список параметров для метода polls.addVote /// </summary> [Serializable] public class PollsAddVoteParams { /// <summary> /// Идентификатор владельца опроса. /// </summary> public long? OwnerId { get; set; } /// <summary> /// True — опрос находится в обсуждении, False — опрос прикреплен к стене. /// По умолчанию — False. /// </summary> public bool? IsBoard { get; set; } /// <summary> /// Идентификатор опроса. /// </summary> public long PollId { get; set; } /// <summary> /// Идентификатор варианта ответа. /// </summary> public long AnswerId { get; set; } } }
21.1875
76
0.631268
[ "MIT" ]
DeNcHiK3713/vk
VkNet/Model/RequestParams/Polls/PollsAddVoteParams.cs
842
C#
using System.Collections.Generic; namespace Fleck2 { public class WebSocketHttpRequest { private readonly IDictionary<string, string> _headers = new Dictionary<string, string>(); public string Method { get; set; } public string Path { get; set; } public string Body { get; set; } public string Scheme { get; set; } public byte[] Bytes { get; set; } public string this[string name] { get { string value; return _headers.TryGetValue(name, out value) ? value : default(string); } } public IDictionary<string, string> Headers { get { return _headers; } } } }
20.333333
97
0.513241
[ "MIT" ]
alastairs/Fleck2
src/WebSocketHttpRequest.cs
793
C#
using System.Collections.Generic; using System.Linq; using NBitcoin; using NBitcoin.DataEncoders; using Newtonsoft.Json; using Stratis.Bitcoin.Controllers.Converters; namespace Stratis.Bitcoin.Controllers.Models { /// <summary> /// A class representing a transaction. /// </summary> public abstract class TransactionModel { public TransactionModel(Network network = null) { } /// <summary> /// Creates a <see cref="TransactionModel"/> containing the hash of the given transaction. /// </summary> /// <param name="trx">A valid <see cref="Transaction"/></param> public TransactionModel(Transaction trx) { this.Hex = trx?.ToHex(); } /// <summary>The hashed transaction.</summary> [JsonProperty(Order = 0, PropertyName = "hex")] public string Hex { get; set; } public override string ToString() { return this.Hex; } } /// <summary> /// Creates a concise transaction model containing the hashed transaction. /// </summary> [JsonConverter(typeof(ToStringJsonConverter))] public class TransactionBriefModel : TransactionModel { public TransactionBriefModel() { } public TransactionBriefModel(Transaction trx) : base(trx) { } } /// <summary> /// Creates a more robust transaction model. /// </summary> public class TransactionVerboseModel : TransactionModel { public TransactionVerboseModel() { } /// <summary> /// Initializes a new instance of the <see cref="TransactionVerboseModel"/> class. /// </summary> /// <param name="trx">The transaction.</param> /// <param name="network">The network the transaction occurred on.</param> /// <param name="block">A <see cref="ChainedHeader"/> of the block that contains the transaction.</param> /// <param name="tip">A <see cref="ChainedHeader"/> of the current tip.</param> public TransactionVerboseModel(Transaction trx, Network network, ChainedHeader block = null, ChainedHeader tip = null) : base(trx) { if (trx != null) { this.TxId = trx.GetHash().ToString(); this.Size = trx.GetSerializedSize(); this.Version = trx.Version; this.LockTime = trx.LockTime; this.VIn = trx.Inputs.Select(txin => new Vin(txin.PrevOut, txin.Sequence, txin.ScriptSig)).ToList(); int n = 0; this.VOut = trx.Outputs.Select(txout => new Vout(n++, txout, network)).ToList(); if (block != null) { this.BlockHash = block.HashBlock.ToString(); this.Time = this.BlockTime = Utils.DateTimeToUnixTime(block.Header.BlockTime); if (tip != null) this.Confirmations = tip.Height - block.Height + 1; } } } /// <summary>The transaction id.</summary> [JsonProperty(Order = 1, PropertyName = "txid")] public string TxId { get; set; } /// <summary>The serialized transaction size.</summary> [JsonProperty(Order = 2, PropertyName = "size")] public int Size { get; set; } /// <summary>The transaction version number (typically 1).</summary> [JsonProperty(Order = 3, PropertyName = "version")] public uint Version { get; set; } /// <summary>If nonzero, block height or timestamp when transaction is final.</summary> [JsonProperty(Order = 4, PropertyName = "locktime")] public uint LockTime { get; set; } /// <summary>A list of inputs.</summary> [JsonProperty(Order = 5, PropertyName = "vin")] public List<Vin> VIn { get; set; } /// <summary>A list of outputs.</summary> [JsonProperty(Order = 6, PropertyName = "vout")] public List<Vout> VOut { get; set; } /// <summary>The hash of the block containing this transaction.</summary> [JsonProperty(Order = 7, PropertyName = "blockhash", DefaultValueHandling = DefaultValueHandling.Ignore)] public string BlockHash { get; set; } /// <summary>The number of confirmations of the transaction.</summary> [JsonProperty(Order = 8, PropertyName = "confirmations", DefaultValueHandling = DefaultValueHandling.Ignore)] public int? Confirmations { get; set; } /// <summary>The time the transaction was added to a block.</summary> [JsonProperty(Order = 9, PropertyName = "time", DefaultValueHandling = DefaultValueHandling.Ignore)] public uint? Time { get; set; } /// <summary>The time the block was confirmed.</summary> [JsonProperty(Order = 10, PropertyName = "blocktime", DefaultValueHandling = DefaultValueHandling.Ignore)] public uint? BlockTime { get; set; } } /// <summary> /// A class describing a transaction input. /// </summary> public class Vin { public Vin() { } /// <summary> /// Initializes a <see cref="Vin"/> instance. /// </summary> /// <param name="prevOut">The previous output being used as an input.</param> /// <param name="sequence">The transaction's sequence number.</param> /// <param name="scriptSig">The scriptSig</param> public Vin(OutPoint prevOut, Sequence sequence, NBitcoin.Script scriptSig) { if (prevOut.Hash == uint256.Zero) { this.Coinbase = Encoders.Hex.EncodeData(scriptSig.ToBytes()); } else { this.TxId = prevOut.Hash.ToString(); this.VOut = prevOut.N; this.ScriptSig = new Script(scriptSig); } this.Sequence = (uint)sequence; } /// <summary>The scriptsig if this was a coinbase transaction.</summary> [JsonProperty(Order = 0, PropertyName = "coinbase", DefaultValueHandling = DefaultValueHandling.Ignore)] public string Coinbase { get; set; } /// <summary>The transaction ID.</summary> [JsonProperty(Order = 1, PropertyName = "txid", DefaultValueHandling = DefaultValueHandling.Ignore)] public string TxId { get; set; } /// <summary>The index of the output.</summary> [JsonProperty(Order = 2, PropertyName = "vout", DefaultValueHandling = DefaultValueHandling.Ignore)] public uint? VOut { get; set; } /// <summary>The transaction's scriptsig.</summary> [JsonProperty(Order = 3, PropertyName = "scriptSig", DefaultValueHandling = DefaultValueHandling.Ignore)] public Script ScriptSig { get; set; } /// <summary>The transaction's sequence number. <see cref="https://bitcoin.org/en/developer-guide#locktime-and-sequence-number"/></summary> [JsonProperty(Order = 4, PropertyName = "sequence")] public uint Sequence { get; set; } } /// <summary> /// A class describing a transaction output. /// </summary> public class Vout { public Vout() { } /// <summary> /// Initializes an instance of the <see cref="Vout"/> class. /// </summary> /// <param name="N">The index of the output.</param> /// <param name="txout">A <see cref="TxOut"/></param> /// <param name="network">The network where the transaction occured.</param> public Vout(int N, TxOut txout, Network network) { this.N = N; this.Value = txout.Value.ToDecimal(MoneyUnit.BTC); this.ScriptPubKey = new ScriptPubKey(txout.ScriptPubKey, network); } /// <summary>The value of the output.</summary> [JsonConverter(typeof(BtcDecimalJsonConverter))] [JsonProperty(Order = 0, PropertyName = "value")] public decimal Value { get; set; } /// <summary>The index of the output.</summary> [JsonProperty(Order = 1, PropertyName = "n")] public int N { get; set; } /// <summary>The output's scriptpubkey.</summary> [JsonProperty(Order = 2, PropertyName = "scriptPubKey")] public ScriptPubKey ScriptPubKey { get; set; } } /// <summary> /// A class describing a transaction script. /// </summary> public class Script { public Script() { } /// <summary> /// Initializes a transaction <see cref="Script"/>, which contains the assembly and a hexadecimal representation of the script. /// </summary> /// <param name="script">A <see cref="NBitcoin.Script"/>.</param> public Script(NBitcoin.Script script) { this.Asm = script.ToString(); this.Hex = Encoders.Hex.EncodeData(script.ToBytes()); } /// <summary>The script's assembly.</summary> [JsonProperty(Order = 0, PropertyName = "asm")] public string Asm { get; set; } /// <summary>A hexadecimal representation of the script.</summary> [JsonProperty(Order = 1, PropertyName = "hex")] public string Hex { get; set; } } /// <summary> /// A class describing a ScriptPubKey. /// </summary> public class ScriptPubKey : Script { public ScriptPubKey() { } /// <summary> /// Initializes an instance of the <see cref="ScriptPubKey"/> class. /// </summary> /// <param name="script">The script.</param> /// <param name="network">The network where the transaction was conducted.</param> public ScriptPubKey(NBitcoin.Script script, Network network) : base(script) { var destinations = new List<TxDestination> { script.GetDestination(network) }; this.Type = this.GetScriptType(script.FindTemplate(network)); if (destinations[0] == null) { destinations = script.GetDestinationPublicKeys(network) .Select(p => p.Hash) .ToList<TxDestination>(); } else { if (destinations.Count == 1) { this.ReqSigs = 1; this.Addresses = new List<string> { destinations[0].GetAddress(network).ToString() }; } else { PayToMultiSigTemplateParameters multi = PayToMultiSigTemplate.Instance.ExtractScriptPubKeyParameters(network, script); this.ReqSigs = multi.SignatureCount; this.Addresses = multi.PubKeys.Select(m => m.GetAddress(network).ToString()).ToList(); } } } /// <summary>The number of required sigs.</summary> [JsonProperty(Order = 2, PropertyName = "reqSigs", DefaultValueHandling = DefaultValueHandling.Ignore)] public int? ReqSigs { get; set; } /// <summary>The type of script.</summary> [JsonProperty(Order = 3, PropertyName = "type", DefaultValueHandling = DefaultValueHandling.Ignore)] public string Type { get; set; } /// <summary>A list of output addresses.</summary> [JsonProperty(Order = 4, PropertyName = "addresses", DefaultValueHandling = DefaultValueHandling.Ignore)] public List<string> Addresses { get; set; } /// <summary> /// A method that returns a script type description. /// </summary> /// <param name="template">A <see cref="ScriptTemplate"/> used for the script.</param> /// <returns>A string describin the script type.</returns> protected string GetScriptType(ScriptTemplate template) { if (template == null) return "nonstandard"; switch (template.Type) { case TxOutType.TX_PUBKEY: return "pubkey"; case TxOutType.TX_PUBKEYHASH: return "pubkeyhash"; case TxOutType.TX_SCRIPTHASH: return "scripthash"; case TxOutType.TX_MULTISIG: return "multisig"; case TxOutType.TX_NULL_DATA: return "nulldata"; } return "nonstandard"; } } }
37.785498
147
0.574958
[ "MIT" ]
BreezeHub/StratisBitcoinFullNode
src/Stratis.Bitcoin/Controllers/Models/TransactionModel.cs
12,509
C#
// Copyright 2022 Eidos-Montreal / Eidos-Sherbrooke // 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 UnrealBuildTool; public class VolumeSequencer : ModuleRules { public VolumeSequencer(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; PrivateDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "LevelSequence", "MovieScene", "RHI", "Slate", "SlateCore", "TimeManagement", } ); if (Target.bBuildEditor) { PrivateDependencyModuleNames.AddRange( new string[] { "AssetTools", "EditorFramework", "EditorStyle", "MovieSceneTools", "MovieSceneTracks", "Sequencer", "UnrealEd" } ); } } }
23.907407
75
0.691712
[ "Apache-2.0" ]
c0rvus-ix/unreal-vdb
Source/Sequencer/VolumeSequencer.build.cs
1,291
C#
// ============================================================================================================== // Microsoft patterns & practices // CQRS Journey project // ============================================================================================================== // ©2012 Microsoft. All rights reserved. Certain content used with permission from contributors // http://cqrsjourney.github.com/contributors/members // 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. // ============================================================================================================== namespace Infrastructure.Sql.BlobStorage { public class BlobEntity { public BlobEntity(string id, string contentType, byte[] blob, string blobString) { this.Id = id; this.ContentType = contentType; this.Blob = blob; this.BlobString = blobString; } protected BlobEntity() { } public string Id { get; private set; } public string ContentType { get; set; } public byte[] Blob { get; set; } /// <devdoc> /// This property is only populated by the SQL implementation /// if the content type of the saved blob is "text/plain". /// </devdoc> public string BlobString { get; set; } } }
44.926829
114
0.542345
[ "Apache-2.0" ]
jelster/cqrs-journey-code
source/Infrastructure/Sql/Infrastructure.Sql/BlobStorage/BlobEntity.cs
1,845
C#
using System.Threading.Tasks; using Abp.Application.Services; using PhapY.Authorization.Accounts.Dto; namespace PhapY.Authorization.Accounts { public interface IAccountAppService : IApplicationService { Task<IsTenantAvailableOutput> IsTenantAvailable(IsTenantAvailableInput input); Task<RegisterOutput> Register(RegisterInput input); } }
26.357143
86
0.780488
[ "MIT" ]
mintaz/PhapY-Project
src/PhapY.Application/Authorization/Accounts/IAccountAppService.cs
371
C#
//------------------------------------------------------------------------------- // <copyright file="IIfSyntax.cs" company="Appccelerate"> // Copyright (c) 2008-2015 // // 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. // </copyright> //------------------------------------------------------------------------------- namespace Appccelerate.StateMachine.Syntax { using System; /// <summary> /// Defines the If syntax. /// </summary> /// <typeparam name="TState">The type of the state.</typeparam> /// <typeparam name="TEvent">The type of the event.</typeparam> public interface IIfSyntax<TState, TEvent> { /// <summary> /// Defines the target state of the transition. /// </summary> /// <param name="target">The target.</param> /// <returns>Go to syntax</returns> IGotoInIfSyntax<TState, TEvent> Goto(TState target); /// <summary> /// Defines the transition actions. /// </summary> /// <param name="action">The actions to execute when the transition is taken.</param> /// <returns>Event syntax</returns> IIfOrOtherwiseSyntax<TState, TEvent> Execute(Action action); /// <summary> /// Defines the transition actions. /// </summary> /// <typeparam name="T">The type of the action argument.</typeparam> /// <param name="action">The actions to execute when the transition is taken.</param> /// <returns>Event syntax</returns> IIfOrOtherwiseSyntax<TState, TEvent> Execute<T>(Action<T> action); } }
41.673077
94
0.577296
[ "Apache-2.0" ]
philippdolder/statemachine
source/Appccelerate.StateMachine/Syntax/IIfSyntax.cs
2,167
C#
using System.Collections.Generic; using System.Linq; using System.Text.Json; using Sentry.Internal.Extensions; namespace Sentry { /// <summary> /// Sentry Stacktrace interface. /// </summary> /// <remarks> /// A stacktrace contains a list of frames, each with various bits (most optional) describing the context of that frame. /// Frames should be sorted from oldest to newest. /// </remarks> /// <see href="https://develop.sentry.dev/sdk/event-payloads/stacktrace/"/> public sealed class SentryStackTrace : IJsonSerializable { internal IList<SentryStackFrame>? InternalFrames { get; private set; } /// <summary> /// The list of frames in the stack. /// </summary> /// <remarks> /// The list of frames should be ordered by the oldest call first. /// </remarks> public IList<SentryStackFrame> Frames { get => InternalFrames ??= new List<SentryStackFrame>(); set => InternalFrames = value; } /// <inheritdoc /> public void WriteTo(Utf8JsonWriter writer) { writer.WriteStartObject(); if (InternalFrames is {} frames && frames.Any()) { writer.WriteStartArray("frames"); foreach (var frame in frames) { writer.WriteSerializableValue(frame); } writer.WriteEndArray(); } writer.WriteEndObject(); } /// <summary> /// Parses from JSON. /// </summary> public static SentryStackTrace FromJson(JsonElement json) { var frames = json .GetPropertyOrNull("frames") ?.EnumerateArray() .Select(SentryStackFrame.FromJson) .ToArray(); return new SentryStackTrace { InternalFrames = frames }; } } }
28.614286
124
0.541687
[ "MIT" ]
FilipNemec/sentry-dotnet
src/Sentry/Exceptions/SentryStackTrace.cs
2,003
C#
// Copyright(c) Microsoft Corporation. // All rights reserved. // // Licensed under the MIT license. See LICENSE file in the solution root folder for full license information using Microsoft.Online.SharePoint.TenantAdministration; using Microsoft.SharePoint.Client; using OfficeDevPnP.Core; using OfficeDevPnP.Core.Framework.Provisioning.Providers; using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml; using System; using static System.Configuration.ConfigurationManager; namespace OpportunitySiteProvisioner { class Program { static void Main(string[] args) { // Grab site from arguments var siteUrl = args[0]; var adminSiteUrl = new Uri(siteUrl.Replace(".sharepoint.com", "-admin.sharepoint.com")).GetLeftPart(UriPartial.Authority); Console.WriteLine($"Site url is \"{siteUrl}\""); // Grab client credentials from configuration var appId = AppSettings["AppId"]; var appSecret = AppSettings["AppSecret"]; // Load the provisioning template Console.WriteLine("Loading template..."); TemplateProviderBase templateProvider = new XMLFileSystemTemplateProvider(".\\", string.Empty); var template = templateProvider.GetTemplate("OpportunitySite.xml"); Console.WriteLine("Template successfully parsed."); // Authenticate using the client credentials flow Console.WriteLine("Attempting OAuth authentication..."); // Prepare site var adminAuthenticationManager = new AuthenticationManager(); using (var adminContext = adminAuthenticationManager.GetAppOnlyAuthenticatedContext(adminSiteUrl, appId, appSecret)) { var tenant = new Tenant(adminContext); tenant.SetSiteProperties(siteUrl, noScriptSite: false); adminContext.ExecuteQuery(); var authenticationManager = new AuthenticationManager(); using (var context = authenticationManager.GetAppOnlyAuthenticatedContext(siteUrl, appId, appSecret)) { Console.WriteLine("Succesfully authenticated. Provisioning..."); // Apply the provisioning template context.Web.ApplyProvisioningTemplate(template); Console.WriteLine("Provisioning was successful."); } } } } }
46.528302
134
0.656123
[ "MIT" ]
jawn/ProposalManager
Utilities/OpportunitySiteProvisioner/Program.cs
2,468
C#
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace Tools_XNA { public class CustomModel { // Variables for each property for a model public Vector3 Position { get; set; } public Vector3 Rotation { get; set; } public Vector3 Scale { get; set; } // Variable for loading in a model with all of its vertices public Model Model { get; set; } // Variable for loading special effects from Material public Material Material { get; set; } // Variable for changing the vertices position in sync private Matrix[] modelTransforms; // Variable declaring that we will use graphicsDevice private GraphicsDevice graphicsDevice; // Constructor for loading a model public CustomModel(Model Model, Vector3 Position, Vector3 Rotation, Vector3 Scale, GraphicsDevice graphicsDevice) { // Model this.Model = Model; // Create vertices from model modelTransforms = new Matrix[Model.Bones.Count]; Model.CopyAbsoluteBoneTransformsTo(modelTransforms); // Generate Tags generateTags(); // Set models vertices with the codes' vertices this.Position = Position; this.Rotation = Rotation; this.Scale = Scale; // Load graphics and material properties this.graphicsDevice = graphicsDevice; this.Material = new Material(); } // Draw method public void Draw(Matrix View, Matrix Projection, Vector3 CameraPosition, float alpha = 0.9f) { // Create a new matrix based on the matrices Scale, Rotation and Translation Matrix baseWorld = Matrix.CreateScale(Scale) * Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) * Matrix.CreateTranslation(Position); // For each model properties (vertices, bones, edges and faces) foreach (ModelMesh mesh in Model.Meshes) { // All the models will be transformed by the baseWorld and then create a local world Matrix localWorld = modelTransforms[mesh.ParentBone.Index] * baseWorld; // View each model based by the position in the world, camera view and screen conversion foreach (ModelMeshPart meshPart in mesh.MeshParts) { Effect effect = meshPart.Effect; if (effect is BasicEffect) { ((BasicEffect)effect).World = localWorld; ((BasicEffect)effect).View = View; ((BasicEffect)effect).Projection = Projection; ((BasicEffect)effect).EnableDefaultLighting(); ((BasicEffect)effect).Alpha = alpha; if (alpha != 1f) // TODO: draw with alpha { graphicsDevice.BlendState = BlendState.AlphaBlend; } } else { setEffectParameter(effect, "World", localWorld); setEffectParameter(effect, "View", View); setEffectParameter(effect, "Projection", Projection); setEffectParameter(effect, "CameraPosition", CameraPosition); Material.SetEffectParameters(effect); } } // Draw all the meshes mesh.Draw(); //if (alpha != 1f) //{ // graphicsDevice.BlendState = BlendState.Opaque; //} } } void setEffectParameter(Effect effect, string paramName, object val) { if (effect.Parameters[paramName] == null) return; if (val is Vector3) effect.Parameters[paramName].SetValue((Vector3)val); else if (val is bool) effect.Parameters[paramName].SetValue((bool)val); else if (val is Matrix) effect.Parameters[paramName].SetValue((Matrix)val); else if (val is Texture2D) effect.Parameters[paramName].SetValue((Texture2D)val); } public void SetModelEffect(Effect effect, bool CopyEffect) { foreach (ModelMesh mesh in Model.Meshes) foreach (ModelMeshPart part in mesh.MeshParts) { Effect toSet = effect; // Copy the effect if necessary if (CopyEffect) { toSet = effect.Clone(); } MeshTag tag = ((MeshTag) part.Tag); // If this ModelMeshPart has a texture, set it to the effect if (tag.Texture != null) { setEffectParameter(toSet, "BasicTexture", tag.Texture); setEffectParameter(toSet, "TextureEnabled", true); } else { setEffectParameter(toSet, "TextureEnabled", false); } // Set our remaining parameters to the effect setEffectParameter(toSet, "DiffuseColor", tag.Color); setEffectParameter(toSet, "SpecularPower", tag.SpecularPower); part.Effect = toSet; } } private void generateTags() { foreach (ModelMesh mesh in Model.Meshes) foreach (ModelMeshPart part in mesh.MeshParts) { if (part.Effect is BasicEffect) { BasicEffect effect = (BasicEffect) part.Effect; MeshTag tag = new MeshTag(effect.DiffuseColor, effect.Texture, effect.SpecularPower); part.Tag = tag; } } } // Store references to all of the model's current effects public void CacheEffects() { foreach (ModelMesh mesh in Model.Meshes) foreach (ModelMeshPart part in mesh.MeshParts) ((MeshTag)part.Tag).CachedEffect = part.Effect; } // Restore the effects referenced by the model's cache public void RestoreEffects() { foreach (ModelMesh mesh in Model.Meshes) foreach (ModelMeshPart part in mesh.MeshParts) if (((MeshTag)part.Tag).CachedEffect != null) { part.Effect = ((MeshTag) part.Tag).CachedEffect; } } } public class MeshTag { public Vector3 Color; public Texture2D Texture; public float SpecularPower; public Effect CachedEffect = null; public MeshTag(Vector3 Color, Texture2D Texture, float SpecularPower) { this.Color = Color; this.Texture = Texture; this.SpecularPower = SpecularPower; } } }
36.338308
109
0.525192
[ "MIT" ]
AlexanderReaper7/GameJam2020
Tools_XNA_dotNET_Framework/Tools_XNA_dotNET_Framework/OldTools/CustomModel.cs
7,306
C#
using System; using System.Collections.Generic; using UnityEngine; public enum TriggerType { Collision, Trigger, Keyboard, ScriptOnly } [Serializable] public class TriggerOptions { [Tooltip("The type of input that triggers the fracture.")] public TriggerType triggerType; [Tooltip("Minimum contact collision force required to cause the object to fracture.")] public float minimumCollisionForce; [Tooltip("If true, only objects with the tags 'Allowed Tags' list will trigger a collision.")] public bool filterCollisionsByTag; [Tooltip("If 'Filter Collisions By Tag' is set to true, only objects with the tags in this list will trigger the fracture.")] public List<string> triggerAllowedTags; [Tooltip("If the trigger type is Keyboard, this is the key code that will trigger a fracture when pressed.")] public KeyCode triggerKey; public TriggerOptions() { this.triggerType = TriggerType.Collision; this.minimumCollisionForce = 0f; this.filterCollisionsByTag = false; this.triggerAllowedTags = new List<string>(); this.triggerKey = KeyCode.None; } /// <summary> /// Returns true if the specified tag is allowed to trigger the fracture /// </summary> /// <param name="tag">The tag to check</param> /// <returns></returns> public bool IsTagAllowed(string tag) { return triggerAllowedTags.Contains(tag); } }
29.18
129
0.693626
[ "MIT" ]
blacksabin/OpenFracture
Runtime/Scripts/Options/TriggerOptions.cs
1,459
C#
using Microsoft.Xna.Framework; using System.Collections.Generic; using System.IO; using System.Linq; using Newtonsoft.Json; namespace ServerSideCharacter.Region { public class RegionInfoData { public List<RegionInfo> ServerRegions = new List<RegionInfo>(); } public class RegionManager { private RegionInfoData _regions = new RegionInfoData(); private static string _filePath = "SSC/regions.json"; public void CreateNewRegion(Rectangle rect, string name, ServerPlayer player) { lock (_regions) { RegionInfo playerRegion = new RegionInfo(name, player, rect); _regions.ServerRegions.Add(playerRegion); player.ownedregion.Add(playerRegion); } } public bool RemoveRegionWithName(string name) { lock (_regions) { int index = _regions.ServerRegions.FindIndex(region => region.Name == name); if (index != -1) { _regions.ServerRegions.RemoveAt(index); foreach (var player in ServerSideCharacter.XmlData.Data) { int id = player.Value.ownedregion.FindIndex(region => region.Name == name); if (id != -1) { player.Value.ownedregion.RemoveAt((id)); } } return true; } else { return false; } } } public bool HasNameConflect(string name) { lock (_regions) { foreach (var region in _regions.ServerRegions) { if (name.Equals(region.Name)) { return true; } } } return false; } public bool CheckPlayerRegionMax(ServerPlayer player) { lock (_regions) { return _regions.ServerRegions.Count(info => info.Owner.Equals(player)) < ServerSideCharacter.Config.PlayerMaxRegions; } } public bool CheckRegionConflict(Rectangle rect) { lock (_regions) { return _regions.ServerRegions.All(region => !region.Area.Intersects(rect)); } } public void ReadRegionInfo() { if (!File.Exists(_filePath)) { string json = JsonConvert.SerializeObject(_regions); using (StreamWriter sw = new StreamWriter(_filePath)) { sw.Write(json); } } else { string json = File.ReadAllText(_filePath); _regions = JsonConvert.DeserializeObject<RegionInfoData>(json); //XmlReaderSettings settings = new XmlReaderSettings {IgnoreComments = true}; ////忽略文档里面的注释 //XmlDocument xmlDoc = new XmlDocument(); //XmlReader reader = XmlReader.Create("SSC/regions.xml", settings); //xmlDoc.Load(reader); //XmlNode xn = xmlDoc.SelectSingleNode("Regions"); //var list = xn.ChildNodes; //foreach (var node in list) //{ // XmlElement regionData = (XmlElement)node; // int uuid = int.Parse(regionData.GetAttribute("uuid")); // var info = regionData.ChildNodes; // Rectangle area = new Rectangle(); // string name = info.Item(0).InnerText; // area.X = Convert.ToInt32(info.Item(1).InnerText); // area.Y = Convert.ToInt32(info.Item(2).InnerText); // area.Width = Convert.ToInt32(info.Item(3).InnerText); // area.Height = Convert.ToInt32(info.Item(4).InnerText); // ServerPlayer player = ServerPlayer.FindPlayer(uuid); // ServerSideCharacter.RegionManager.CreateNewRegion(area, name, player); //} } } public void WriteRegionInfo() { lock (_regions) { string json = JsonConvert.SerializeObject(_regions, Newtonsoft.Json.Formatting.Indented); using (StreamWriter sw = new StreamWriter(_filePath)) { sw.Write(json); } } } public bool CheckRegion(int X, int Y, ServerPlayer player) { lock (_regions) { Vector2 tilePos = new Vector2(X, Y); foreach (var regions in _regions.ServerRegions) { if (regions.Area.Contains(X, Y) && !regions.Owner.Equals(player) && !regions.SharedOwner.Contains(player.UUID)) { return true; } } } return false; } public bool CheckRegionSize(ServerPlayer player, Rectangle area) { return player.PermissionGroup.IsSuperAdmin() || (area.Width < ServerSideCharacter.Config.MaxRegionWidth && area.Height < ServerSideCharacter.Config.MaxRegionHeigth); } public void ShareRegion(ServerPlayer p, ServerPlayer target, string name) { int index = _regions.ServerRegions.FindIndex(region => region.Name == name); if (index == -1) { p.SendErrorInfo("Cannot find this region!"); return; } var reg = _regions.ServerRegions[index]; reg.SharedOwner.Add(target.UUID); p.SendSuccessInfo("Successfully shared " + reg.Name + " to " + target.Name); target.SendSuccessInfo(p.Name + " shared region " + reg.Name + " with you!"); } internal bool ValidRegion(ServerPlayer player, string name, Rectangle area) { return !HasNameConflect(name) && _regions.ServerRegions.Count < ServerSideCharacter.Config.MaxRegions && CheckPlayerRegionMax(player) && CheckRegionConflict(area) && CheckRegionSize(player, area); } public List<RegionInfo> GetList() { return _regions.ServerRegions; } } }
26.253968
121
0.672108
[ "MIT" ]
bdfzchen2015/ServerSideCharacter
Region/RegionManager.cs
4,982
C#
using System.Collections.Generic; using GW2EIEvtcParser; using GW2EIEvtcParser.EIData; using GW2EIEvtcParser.ParsedData; namespace GW2EIBuilders.HtmlModels { internal class SkillDto { public long Id { get; set; } public string Name { get; set; } public string Icon { get; set; } public bool Aa { get; set; } public bool IsSwap { get; set; } public bool NotAccurate { get; set; } public static void AssembleSkills(ICollection<SkillItem> skills, Dictionary<string, SkillDto> dict, SkillData skillData) { foreach (SkillItem skill in skills) { dict["s" + skill.ID] = new SkillDto() { Id = skill.ID, Name = skill.Name, Icon = skill.Icon, Aa = skill.AA, IsSwap = skill.IsSwap, NotAccurate = skillData.IsNotAccurate(skill.ID) }; } } private static object[] GetSkillData(AbstractCastEvent cl, long phaseStart) { object[] rotEntry = new object[5]; double start = (cl.Time - phaseStart) / 1000.0; rotEntry[0] = start; rotEntry[1] = cl.SkillId; rotEntry[2] = cl.ActualDuration; rotEntry[3] = (int)cl.Status; rotEntry[4] = cl.Acceleration; return rotEntry; } public static List<object[]> BuildRotationData(ParsedEvtcLog log, AbstractSingleActor p, PhaseData phase, Dictionary<long, SkillItem> usedSkills) { var list = new List<object[]>(); IReadOnlyList<AbstractCastEvent> casting = p.GetIntersectingCastEvents(log, phase.Start, phase.End); foreach (AbstractCastEvent cl in casting) { if (!usedSkills.ContainsKey(cl.SkillId)) { usedSkills.Add(cl.SkillId, cl.Skill); } list.Add(GetSkillData(cl, phase.Start)); } return list; } } }
34.064516
153
0.539299
[ "MIT" ]
Krappa322/GW2-Elite-Insights-Parser
GW2EIBuilders/HtmlModels/SkillDto.cs
2,114
C#
using System; using System.Collections.Generic; using Mors.Maybes.Test.Extensions; using NUnit.Framework; namespace Mors.Maybes.Test.Equality { [TestFixtureSource( typeof(Uses_of_typed_equality_comparers_with_maybes), nameof(Uses_of_typed_equality_comparers_with_maybes.TestFixtureData))] public sealed class Tests_of_maybes_with_typed_equality_comparers { private readonly Func<int, int, IEqualityComparer<int>, bool> _useThatCallsComparer; public Tests_of_maybes_with_typed_equality_comparers( Func<int, int, IEqualityComparer<int>, bool> useThatCallsComparer) { _useThatCallsComparer = useThatCallsComparer; } public static TestFixtureData TestFixtureData( Func<int, int, IEqualityComparer<int>, bool> equalsThatUsesComparer) => new TestFixtureData(equalsThatUsesComparer); [Test] public void Use_passes_first_value_to_comparer() { IEqualityComparer<int> Comparer(RecordedValue a) => new EqualityComparer((x, y) => a.Record(x).Return(true)); Assert.That( a => _useThatCallsComparer(2, 3, Comparer(a)), Is.RecordedValue.EqualTo(2)); } [Test] public void Use_passes_second_value_to_comparer() { IEqualityComparer<int> Comparer(RecordedValue a) => new EqualityComparer((x, y) => a.Record(y).Return(true)); Assert.That( a => _useThatCallsComparer(2, 3, Comparer(a)), Is.RecordedValue.EqualTo(3)); } [Test] public void Use_returns_result_of_comparer() { var comparer = new EqualityComparer((x, y) => false); Assert.That( _useThatCallsComparer(1, 1, comparer), Is.False); } private sealed class EqualityComparer : IEqualityComparer<int> { private readonly Func<int, int, bool> _equals; public EqualityComparer(Func<int, int, bool> equals) => _equals = equals; public bool Equals(int x, int y) => _equals(x, y); public int GetHashCode(int obj) => throw new NotImplementedException(); } } }
35.138462
92
0.622592
[ "MIT" ]
morsiu/Maybes
Mors.Maybes.Test/Equality/Tests_of_maybes_with_typed_equality_comparers.cs
2,286
C#
using Task_06.Controllers; namespace Task_06 { class Program { static void Main(string[] args) { PoolController controller = new PoolController(); } } }
15.615385
61
0.571429
[ "MIT" ]
dimitarminchev/ITCareer
07. Software Development/2020/1. MVC/Task_06/Program.cs
205
C#
/* * Copyright 2020 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 codepipeline-2015-07-09.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.CodePipeline.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.CodePipeline.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for ActionTypeNotFoundException Object /// </summary> public class ActionTypeNotFoundExceptionUnmarshaller : IErrorResponseUnmarshaller<ActionTypeNotFoundException, JsonUnmarshallerContext> { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public ActionTypeNotFoundException Unmarshall(JsonUnmarshallerContext context) { return this.Unmarshall(context, new ErrorResponse()); } /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <param name="errorResponse"></param> /// <returns></returns> public ActionTypeNotFoundException Unmarshall(JsonUnmarshallerContext context, ErrorResponse errorResponse) { context.Read(); ActionTypeNotFoundException unmarshalledObject = new ActionTypeNotFoundException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { } return unmarshalledObject; } private static ActionTypeNotFoundExceptionUnmarshaller _instance = new ActionTypeNotFoundExceptionUnmarshaller(); /// <summary> /// Gets the singleton. /// </summary> public static ActionTypeNotFoundExceptionUnmarshaller Instance { get { return _instance; } } } }
35.364706
145
0.675316
[ "Apache-2.0" ]
DetlefGolze/aws-sdk-net
sdk/src/Services/CodePipeline/Generated/Model/Internal/MarshallTransformations/ActionTypeNotFoundExceptionUnmarshaller.cs
3,006
C#
using hw.DebugFormatter; using hw.Helper; using hw.Scanner; // ReSharper disable CheckNamespace namespace hw.Parser { /// <summary> /// Provides a token factory that caches the items used. /// It is also used internally, so you can define token factories, /// that may use laborious functions in your token factory. /// </summary> /// <typeparam name="TTreeItem"></typeparam> public sealed class CachingTokenFactory<TTreeItem> : Dumpable , ITokenFactory<TTreeItem> where TTreeItem : class { readonly ValueCache<IParserTokenType<TTreeItem>> BeginOfTextCache; readonly ValueCache<LexerItem[]> ClassesCache; readonly ValueCache<IScannerTokenType> EndOfTextCache; readonly ValueCache<IScannerTokenType> InvalidCharacterErrorCache; public CachingTokenFactory(ITokenFactory<TTreeItem> target) { EndOfTextCache = new ValueCache<IScannerTokenType>(() => target.EndOfText); BeginOfTextCache = new ValueCache<IParserTokenType<TTreeItem>>(() => target.BeginOfText); InvalidCharacterErrorCache = new ValueCache<IScannerTokenType>(() => target.InvalidCharacterError); ClassesCache = new ValueCache<LexerItem[]>(() => target.Classes); } LexerItem[] ITokenFactory.Classes => ClassesCache.Value; IScannerTokenType ITokenFactory.EndOfText => EndOfTextCache.Value; IScannerTokenType ITokenFactory.InvalidCharacterError => InvalidCharacterErrorCache.Value; IParserTokenType<TTreeItem> ITokenFactory<TTreeItem>.BeginOfText => BeginOfTextCache.Value; } }
43.421053
111
0.702424
[ "MIT" ]
hahoyer/HWClassLibrary.cs
src/Tester/hw/Parser/CachingTokenFactory.cs
1,652
C#
namespace OggVorbisEncoder.Setup.Templates.BookBlocks.Stereo16.Uncoupled.Chapter0 { public class Page1_0 : IStaticCodeBook { public int Dimensions { get; } = 4; public byte[] LengthList { get; } = { 1, 4, 4, 5, 7, 7, 5, 7, 8, 5, 8, 8, 8,10,10, 8, 10,11, 5, 8, 8, 8,10,10, 8,10,10, 4, 9, 9, 9,12, 11, 8,11,11, 8,12,11,10,12,14,10,13,13, 7,11,11, 10,14,12,11,14,14, 4, 9, 9, 8,11,11, 9,11,12, 7, 11,11,10,13,14,10,12,14, 8,11,12,10,14,14,10,13, 12, }; public CodeBookMapType MapType { get; } = (CodeBookMapType)1; public int QuantMin { get; } = -535822336; public int QuantDelta { get; } = 1611661312; public int Quant { get; } = 2; public int QuantSequenceP { get; } = 0; public int[] QuantList { get; } = { 1, 0, 2, }; } }
31.214286
81
0.525172
[ "MIT" ]
FriesBoury/.NET-Ogg-Vorbis-Encoder
OggVorbisEncoder/Setup/Templates/BookBlocks/Stereo16/Uncoupled/Chapter0/Page1_0.cs
874
C#
using System; using System.Diagnostics; using System.Threading; namespace SEDC.Adv.Class09.Events { class Program { static void Main(string[] args) { var blockBaseterStore = new BlockbasterStore(); // publisher var rentalStore = new RentalStore(); // publisher var emailService = new EmailService(); // subscriber var pushNotification = new PushNotifications(); // subscriber //rentalStore.NotifyUsers += emailService.SendMail; //rentalStore.NotifyUsers += pushNotification.SendPushNotifications; //rentalStore.NotifyUsersVideoEvent += emailService.SendMail; //rentalStore.NotifyUsersVideoEvent += pushNotification.SendPushNotifications; //blockBaseterStore.Notifications += emailService.SendMail; //blockBaseterStore.NewMovieRelase(new Movie() { Title = "Treto poluvreme" }); //Thread.Sleep(4000); //rentalStore.AddNewMovie("SomeMovie"); Console.ReadLine(); } public static void TryingTimer() { // Example for using stopwatch var stopwatch = new Stopwatch(); stopwatch.Start(); Console.WriteLine(stopwatch.Elapsed); Thread.Sleep(3000); Console.WriteLine(stopwatch.Elapsed); stopwatch.Stop(); } } }
29.416667
90
0.611898
[ "MIT" ]
sedc-codecademy/skwd8-06-csharpadv
g6/Class09/SEDC.Adv.Class09/SEDC.Adv.Class09.Events/Program.cs
1,414
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("Mediator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mediator")] [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("21ddc6c2-efb4-4378-a0ff-fdeee211f7df")] // 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.540541
84
0.743701
[ "MIT" ]
ivandrofly/Do-factory---.Net-Design-Pattern
Mediator/Properties/AssemblyInfo.cs
1,392
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.Linq; using System.Management.Automation; using static Microsoft.Azure.PowerShell.Cmdlets.DigitalTwins.Runtime.PowerShell.PsHelpers; namespace Microsoft.Azure.PowerShell.Cmdlets.DigitalTwins.Runtime.PowerShell { [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] [OutputType(typeof(string[]))] [DoNotExport] public class GetScriptCmdlet : PSCmdlet { [Parameter(Mandatory = true)] [ValidateNotNullOrEmpty] public string ScriptFolder { get; set; } [Parameter] public SwitchParameter IncludeDoNotExport { get; set; } [Parameter] public SwitchParameter AsAlias { get; set; } [Parameter] public SwitchParameter AsFunctionInfo { get; set; } protected override void ProcessRecord() { try { var functionInfos = GetScriptCmdlets(this, ScriptFolder) .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType<DoNotExportAttribute>().Any()) .ToArray(); if (AsFunctionInfo) { WriteObject(functionInfos, true); return; } var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); var names = functionInfos.Select(fi => fi.Name).Distinct(); var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); WriteObject(output, true); } catch (System.Exception ee) { System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); throw ee; } } } }
35.462963
112
0.581723
[ "MIT" ]
3quanfeng/azure-powershell
src/DigitalTwins/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs
1,862
C#
// Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Text; using System.Threading.Tasks; using Windows.Storage; using Windows.Storage.Streams; using Windows.Foundation; using Windows.Web; using Windows.Security.Cryptography; namespace SDK.WebViewSampleCS { public sealed class StreamUriResolver : IUriToStreamResolver { public IAsyncOperation<IInputStream> UriToStreamAsync(System.Uri uri) { // The WebView's buildLocalStreamUri method takes contentIdentifier and relativePath // parameters to generate a URI of the form: // ms-local-stream://<package name>_<encoded contentIdentifier>/<relativePath> // The resolver can decode the contentIdentifier to determine what content should be // returned in the output stream. string host = uri.Host; int delimiter = host.LastIndexOf('_'); string encodedContentId = host.Substring(delimiter + 1); IBuffer buffer = CryptographicBuffer.DecodeFromHexString(encodedContentId); string contentIdentifier = CryptographicBuffer.ConvertBinaryToString(BinaryStringEncoding.Utf8, buffer); string relativePath = uri.PathAndQuery; // For this sample, we will return a stream for a file under the local app data // folder, under the subfolder named after the contentIdentifier and having the // given relativePath. Real apps can have more complex behavior, such as handling // contentIdentifiers in a custom manner (not necessarily as paths), and generating // arbitrary streams that are not read directly from a file. System.Uri appDataUri = new Uri("ms-appdata:///local/" + contentIdentifier + relativePath); return GetFileStreamFromApplicationUriAsync(appDataUri).AsAsyncOperation(); } private async Task<IInputStream> GetFileStreamFromApplicationUriAsync(System.Uri uri) { StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri); IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read); return stream; } } }
46.55102
117
0.680403
[ "MIT" ]
mfloresn90/CSharpSources
HTML WebView control sample/C# and C++ and JavaScript/StreamUriResolver/CS/StreamUriResolver.cs
2,283
C#
// Copyright (c) Umbraco. // See LICENSE for more details. using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Routing; using Moq; using NUnit.Framework; using Umbraco.Cms.Web.BackOffice.Filters; namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.BackOffice.Filters { [TestFixture] public class ValidationFilterAttributeTests { [Test] public void Does_Not_Set_Result_When_No_Errors_In_Model_State() { // Arrange ActionExecutingContext context = CreateContext(); var attribute = new ValidationFilterAttribute(); // Act attribute.OnActionExecuting(context); // Assert Assert.IsNull(context.Result); } [Test] public void Returns_Bad_Request_When_Errors_In_Model_State() { // Arrange ActionExecutingContext context = CreateContext(withError: true); var attribute = new ValidationFilterAttribute(); // Act attribute.OnActionExecuting(context); // Assert var typedResult = context.Result as BadRequestObjectResult; Assert.IsNotNull(typedResult); } private static ActionExecutingContext CreateContext(bool withError = false) { var httpContext = new DefaultHttpContext(); var modelState = new ModelStateDictionary(); if (withError) { modelState.AddModelError(string.Empty, "Error"); } var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor(), modelState); return new ActionExecutingContext( actionContext, new List<IFilterMetadata>(), new Dictionary<string, object>(), new Mock<Controller>().Object); } } }
30.362319
116
0.633413
[ "MIT" ]
Ambertvu/Umbraco-CMS
tests/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Filters/ValidationFilterAttributeTests.cs
2,095
C#
namespace schedule.api.framework.Enums { public enum Faculties { Electronics, Mechanics, Designs } }
13.8
39
0.57971
[ "MIT" ]
youstinus/schedule
schedule.api.framework/Enums/Faculties.cs
140
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace MathMLToCSharp.UI.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MathMLToCSharp.UI.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
43.703125
183
0.61423
[ "MIT" ]
Maximilian-Renner/MathMLToCSharp
MathMLToCSharp.UI/Properties/Resources.Designer.cs
2,799
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using BankProject.DBContext; using System.Linq.Expressions; namespace BankProject.DBRespository { /****************************************************************************** * Description: * Concerate Repository for Collaterat Right * Created By: * Nghia Le ******************************************************************************/ /** * *****HISTORY**** * Date By Description of change * ************************************************************************** * 10-Sep-2014 Nghia Init code * * * * * **************************************************************************** */ public class CollateralInformationRepository : BaseRepository<BCOLLATERAL_INFOMATION> { public IQueryable<BCOLLATERAL_INFOMATION> FindCollorateInformationByCust(string custID) { Expression<Func<BCOLLATERAL_INFOMATION, bool>> query = t => t.CustomerID == custID; return Find(query); } } }
32.945946
96
0.415915
[ "Apache-2.0", "BSD-3-Clause" ]
nguyenppt/1pubcreditnew
DesktopModules/TrainingCoreBanking/BankProject/DBRespository/CollateralInformationRepository.cs
1,221
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Reflection; using System.Globalization; using System.Threading; using System.Collections.Generic; using System.Runtime.Serialization; using System.Runtime.CompilerServices; using System.Diagnostics.Contracts; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Diagnostics; namespace System { // Keep this in sync with FormatFlags defined in typestring.h internal enum TypeNameFormatFlags { FormatBasic = 0x00000000, // Not a bitmask, simply the tersest flag settings possible FormatNamespace = 0x00000001, // Include namespace and/or enclosing class names in type names FormatFullInst = 0x00000002, // Include namespace and assembly in generic types (regardless of other flag settings) FormatAssembly = 0x00000004, // Include assembly display name in type names FormatSignature = 0x00000008, // Include signature in method names FormatNoVersion = 0x00000010, // Suppress version and culture information in all assembly names #if _DEBUG FormatDebug = 0x00000020, // For debug printing of types only #endif FormatAngleBrackets = 0x00000040, // Whether generic types are C<T> or C[T] FormatStubInfo = 0x00000080, // Include stub info like {unbox-stub} FormatGenericParam = 0x00000100, // Use !name and !!name for generic type and method parameters // If we want to be able to distinguish between overloads whose parameter types have the same name but come from different assemblies, // we can add FormatAssembly | FormatNoVersion to FormatSerialization. But we are omitting it because it is not a useful scenario // and including the assembly name will normally increase the size of the serialized data and also decrease the performance. FormatSerialization = FormatNamespace | FormatGenericParam | FormatFullInst } internal enum TypeNameKind { Name, ToString, SerializationName, FullName, } internal partial class RuntimeType { #region Definitions internal enum MemberListType { All, CaseSensitive, CaseInsensitive, HandleToInfo } // Helper to build lists of MemberInfos. Special cased to avoid allocations for lists of one element. private struct ListBuilder<T> where T : class? { private T[]? _items; private T _item; private int _count; private int _capacity; public ListBuilder(int capacity) { _items = null; _item = null!; _count = 0; _capacity = capacity; } public T this[int index] { get { Debug.Assert(index < Count); return (_items != null) ? _items[index] : _item; } } public T[] ToArray() { if (_count == 0) return Array.Empty<T>(); if (_count == 1) return new T[1] { _item }; Array.Resize(ref _items, _count); _capacity = _count; return _items; } public void CopyTo(object?[] array, int index) { if (_count == 0) return; if (_count == 1) { array[index] = _item; return; } Array.Copy(_items!, 0, array, index, _count); } public int Count { get { return _count; } } public void Add(T item) { if (_count == 0) { _item = item; } else { if (_count == 1) { if (_capacity < 2) _capacity = 4; _items = new T[_capacity]; _items[0] = _item; } else if (_capacity == _count) { int newCapacity = 2 * _capacity; Array.Resize(ref _items, newCapacity); _capacity = newCapacity; } _items![_count] = item; } _count++; } } #endregion #region Static Members #region Internal [RequiresUnreferencedCode("Types might be removed")] internal static RuntimeType? GetType(string typeName, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref StackCrawlMark stackMark) { if (typeName == null) throw new ArgumentNullException(nameof(typeName)); return RuntimeTypeHandle.GetTypeByName( typeName, throwOnError, ignoreCase, reflectionOnly, ref stackMark, false); } private static void ThrowIfTypeNeverValidGenericArgument(RuntimeType type) { if (type.IsPointer || type.IsByRef || type == typeof(void)) throw new ArgumentException( Environment.GetResourceString("Argument_NeverValidGenericArgument", type.ToString())); } internal static void SanityCheckGenericArguments(RuntimeType[] genericArguments, RuntimeType[] genericParamters) { if (genericArguments == null) throw new ArgumentNullException(); for (int i = 0; i < genericArguments.Length; i++) { if (genericArguments[i] == null) throw new ArgumentNullException(); ThrowIfTypeNeverValidGenericArgument(genericArguments[i]); } if (genericArguments.Length != genericParamters.Length) throw new ArgumentException( Environment.GetResourceString("Argument_NotEnoughGenArguments", genericArguments.Length, genericParamters.Length)); } private static void SplitName(string? fullname, out string? name, out string? ns) { name = null; ns = null; if (fullname == null) return; // Get namespace int nsDelimiter = fullname.LastIndexOf(".", StringComparison.Ordinal); if (nsDelimiter != -1) { ns = fullname.Substring(0, nsDelimiter); int nameLength = fullname.Length - ns.Length - 1; if (nameLength != 0) name = fullname.Substring(nsDelimiter + 1, nameLength); else name = ""; Debug.Assert(fullname.Equals(ns + "." + name)); } else { name = fullname; } } #endregion #region Filters internal static BindingFlags FilterPreCalculate(bool isPublic, bool isInherited, bool isStatic) { BindingFlags bindingFlags = isPublic ? BindingFlags.Public : BindingFlags.NonPublic; if (isInherited) { // We arrange things so the DeclaredOnly flag means "include inherited members" bindingFlags |= BindingFlags.DeclaredOnly; if (isStatic) { bindingFlags |= BindingFlags.Static | BindingFlags.FlattenHierarchy; } else { bindingFlags |= BindingFlags.Instance; } } else { if (isStatic) { bindingFlags |= BindingFlags.Static; } else { bindingFlags |= BindingFlags.Instance; } } return bindingFlags; } // Calculate prefixLookup, ignoreCase, and listType for use by GetXXXCandidates private static void FilterHelper( BindingFlags bindingFlags, ref string? name, bool allowPrefixLookup, out bool prefixLookup, out bool ignoreCase, out MemberListType listType) { prefixLookup = false; ignoreCase = false; if (name != null) { if ((bindingFlags & BindingFlags.IgnoreCase) != 0) { name = name.ToLowerInvariant(); ignoreCase = true; listType = MemberListType.CaseInsensitive; } else { listType = MemberListType.CaseSensitive; } if (allowPrefixLookup && name.EndsWith("*", StringComparison.Ordinal)) { // We set prefixLookup to true if name ends with a "*". // We will also set listType to All so that all members are included in // the candidates which are later filtered by FilterApplyPrefixLookup. name = name.Substring(0, name.Length - 1); prefixLookup = true; listType = MemberListType.All; } } else { listType = MemberListType.All; } } // Used by the singular GetXXX APIs (Event, Field, Interface, NestedType) where prefixLookup is not supported. private static void FilterHelper(BindingFlags bindingFlags, ref string? name, out bool ignoreCase, out MemberListType listType) { bool prefixLookup; FilterHelper(bindingFlags, ref name, false, out prefixLookup, out ignoreCase, out listType); } // Only called by GetXXXCandidates, GetInterfaces, and GetNestedTypes when FilterHelper has set "prefixLookup" to true. // Most of the plural GetXXX methods allow prefix lookups while the singular GetXXX methods mostly do not. private static bool FilterApplyPrefixLookup(MemberInfo memberInfo, string? name, bool ignoreCase) { Debug.Assert(name != null); if (ignoreCase) { if (!memberInfo.Name.StartsWith(name, StringComparison.OrdinalIgnoreCase)) return false; } else { if (!memberInfo.Name.StartsWith(name, StringComparison.Ordinal)) return false; } return true; } // Used by FilterApplyType to perform all the filtering based on name and BindingFlags private static bool FilterApplyBase( MemberInfo memberInfo, BindingFlags bindingFlags, bool isPublic, bool isNonProtectedInternal, bool isStatic, string? name, bool prefixLookup) { #region Preconditions Debug.Assert(memberInfo != null); Debug.Assert(name == null || (bindingFlags & BindingFlags.IgnoreCase) == 0 || (name.ToLowerInvariant().Equals(name))); #endregion #region Filter by Public & Private if (isPublic) { if ((bindingFlags & BindingFlags.Public) == 0) return false; } else { if ((bindingFlags & BindingFlags.NonPublic) == 0) return false; } #endregion bool isInherited = !ReferenceEquals(memberInfo.DeclaringType, memberInfo.ReflectedType); #region Filter by DeclaredOnly if ((bindingFlags & BindingFlags.DeclaredOnly) != 0 && isInherited) return false; #endregion #region Filter by Static & Instance if (memberInfo.MemberType != MemberTypes.TypeInfo && memberInfo.MemberType != MemberTypes.NestedType) { if (isStatic) { if ((bindingFlags & BindingFlags.FlattenHierarchy) == 0 && isInherited) return false; if ((bindingFlags & BindingFlags.Static) == 0) return false; } else { if ((bindingFlags & BindingFlags.Instance) == 0) return false; } } #endregion #region Filter by name wrt prefixLookup and implicitly by case sensitivity if (prefixLookup == true) { if (!FilterApplyPrefixLookup(memberInfo, name, (bindingFlags & BindingFlags.IgnoreCase) != 0)) return false; } #endregion #region Asymmetries // @Asymmetry - Internal, inherited, instance, non-protected, non-virtual, non-abstract members returned // iff BindingFlags !DeclaredOnly, Instance and Public are present except for fields if (((bindingFlags & BindingFlags.DeclaredOnly) == 0) && // DeclaredOnly not present isInherited && // Is inherited Member (isNonProtectedInternal) && // Is non-protected internal member ((bindingFlags & BindingFlags.NonPublic) != 0) && // BindingFlag.NonPublic present (!isStatic) && // Is instance member ((bindingFlags & BindingFlags.Instance) != 0)) // BindingFlag.Instance present { MethodInfo? methodInfo = memberInfo as MethodInfo; if (methodInfo == null) return false; if (!methodInfo.IsVirtual && !methodInfo.IsAbstract) return false; } #endregion return true; } // Used by GetInterface and GetNestedType(s) which don't need parameter type filtering. private static bool FilterApplyType( Type type, BindingFlags bindingFlags, string? name, bool prefixLookup, string? ns) { Debug.Assert(type is RuntimeType); bool isPublic = type.IsNestedPublic || type.IsPublic; bool isStatic = false; if (!FilterApplyBase(type, bindingFlags, isPublic, type.IsNestedAssembly, isStatic, name, prefixLookup)) return false; if (ns != null && ns != type.Namespace) return false; return true; } private static bool FilterApplyMethodInfo( RuntimeMethodInfo method, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes) { // Optimization: Pre-Calculate the method binding flags to avoid casting. return FilterApplyMethodBase(method, bindingFlags, callConv, argumentTypes); } private static bool FilterApplyConstructorInfo( RuntimeConstructorInfo constructor, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes) { // Optimization: Pre-Calculate the method binding flags to avoid casting. return FilterApplyMethodBase(constructor, bindingFlags, callConv, argumentTypes); } // Used by GetMethodCandidates/GetConstructorCandidates, InvokeMember, and CreateInstanceImpl to perform the necessary filtering. // Should only be called by FilterApplyMethodInfo and FilterApplyConstructorInfo. private static bool FilterApplyMethodBase( MethodBase methodBase, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes) { Debug.Assert(methodBase != null); bindingFlags ^= BindingFlags.DeclaredOnly; #region Check CallingConvention if ((callConv & CallingConventions.Any) == 0) { if ((callConv & CallingConventions.VarArgs) != 0 && (methodBase.CallingConvention & CallingConventions.VarArgs) == 0) return false; if ((callConv & CallingConventions.Standard) != 0 && (methodBase.CallingConvention & CallingConventions.Standard) == 0) return false; } #endregion #region If argumentTypes supplied if (argumentTypes != null) { ParameterInfo[] parameterInfos = methodBase.GetParametersNoCopy(); if (argumentTypes.Length != parameterInfos.Length) { #region Invoke Member, Get\Set & Create Instance specific case // If the number of supplied arguments differs than the number in the signature AND // we are not filtering for a dynamic call -- InvokeMethod or CreateInstance -- filter out the method. if ((bindingFlags & (BindingFlags.InvokeMethod | BindingFlags.CreateInstance | BindingFlags.GetProperty | BindingFlags.SetProperty)) == 0) return false; bool testForParamArray = false; bool excessSuppliedArguments = argumentTypes.Length > parameterInfos.Length; if (excessSuppliedArguments) { // more supplied arguments than parameters, additional arguments could be vararg #region Varargs // If method is not vararg, additional arguments can not be passed as vararg if ((methodBase.CallingConvention & CallingConventions.VarArgs) == 0) { testForParamArray = true; } else { // If Binding flags did not include varargs we would have filtered this vararg method. // This Invariant established during callConv check. Debug.Assert((callConv & CallingConventions.VarArgs) != 0); } #endregion } else {// fewer supplied arguments than parameters, missing arguments could be optional #region OptionalParamBinding if ((bindingFlags & BindingFlags.OptionalParamBinding) == 0) { testForParamArray = true; } else { // From our existing code, our policy here is that if a parameterInfo // is optional then all subsequent parameterInfos shall be optional. // Thus, iff the first parameterInfo is not optional then this MethodInfo is no longer a canidate. if (!parameterInfos[argumentTypes.Length].IsOptional) testForParamArray = true; } #endregion } #region ParamArray if (testForParamArray) { if (parameterInfos.Length == 0) return false; // The last argument of the signature could be a param array. bool shortByMoreThanOneSuppliedArgument = argumentTypes.Length < parameterInfos.Length - 1; if (shortByMoreThanOneSuppliedArgument) return false; ParameterInfo lastParameter = parameterInfos[parameterInfos.Length - 1]; if (!lastParameter.ParameterType.IsArray) return false; if (!lastParameter.IsDefined(typeof(ParamArrayAttribute), false)) return false; } #endregion #endregion } else { #region Exact Binding if ((bindingFlags & BindingFlags.ExactBinding) != 0) { // Legacy behavior is to ignore ExactBinding when InvokeMember is specified. // Why filter by InvokeMember? If the answer is we leave this to the binder then why not leave // all the rest of this to the binder too? Further, what other semanitc would the binder // use for BindingFlags.ExactBinding besides this one? Further, why not include CreateInstance // in this if statement? That's just InvokeMethod with a constructor, right? if ((bindingFlags & (BindingFlags.InvokeMethod)) == 0) { for (int i = 0; i < parameterInfos.Length; i++) { // a null argument type implies a null arg which is always a perfect match if (argumentTypes[i] is not null && !argumentTypes[i].MatchesParameterTypeExactly(parameterInfos[i])) return false; } } } #endregion } } #endregion return true; } #endregion #endregion #region Private Data Members internal static readonly RuntimeType ValueType = (RuntimeType)typeof(System.ValueType); internal static readonly RuntimeType EnumType = (RuntimeType)typeof(System.Enum); private static readonly RuntimeType ObjectType = (RuntimeType)typeof(object); private static readonly RuntimeType StringType = (RuntimeType)typeof(string); #endregion #region Constructor internal RuntimeType() { throw new NotSupportedException(); } #endregion #region Type Overrides #region Get XXXInfo Candidates private ListBuilder<MethodInfo> GetMethodCandidates( string? name, BindingFlags bindingAttr, CallingConventions callConv, Type[]? types, int genericParamCount, bool allowPrefixLookup) { bool prefixLookup, ignoreCase; MemberListType listType; FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType); RuntimeMethodInfo[] cache = GetMethodsByName(name, bindingAttr, listType, this); ListBuilder<MethodInfo> candidates = new ListBuilder<MethodInfo>(cache.Length); for (int i = 0; i < cache.Length; i++) { RuntimeMethodInfo methodInfo = cache[i]; if (genericParamCount != -1) { bool is_generic = methodInfo.IsGenericMethod; if (genericParamCount == 0 && is_generic) continue; else if (genericParamCount > 0 && !is_generic) continue; Type[]? args = methodInfo.GetGenericArguments(); if (args.Length != genericParamCount) continue; } if (FilterApplyMethodInfo(methodInfo, bindingAttr, callConv, types) && (!prefixLookup || FilterApplyPrefixLookup(methodInfo, name, ignoreCase))) { candidates.Add(methodInfo); } } return candidates; } private ListBuilder<ConstructorInfo> GetConstructorCandidates( string? name, BindingFlags bindingAttr, CallingConventions callConv, Type[]? types, bool allowPrefixLookup) { bool prefixLookup, ignoreCase; MemberListType listType; FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType); if (!string.IsNullOrEmpty(name) && name != ConstructorInfo.ConstructorName && name != ConstructorInfo.TypeConstructorName) return new ListBuilder<ConstructorInfo>(0); RuntimeConstructorInfo[] cache = GetConstructors_internal(bindingAttr, this); ListBuilder<ConstructorInfo> candidates = new ListBuilder<ConstructorInfo>(cache.Length); for (int i = 0; i < cache.Length; i++) { RuntimeConstructorInfo constructorInfo = cache[i]; if (FilterApplyConstructorInfo(constructorInfo, bindingAttr, callConv, types) && (!prefixLookup || FilterApplyPrefixLookup(constructorInfo, name, ignoreCase))) { candidates.Add(constructorInfo); } } return candidates; } private ListBuilder<PropertyInfo> GetPropertyCandidates( string? name, BindingFlags bindingAttr, Type[]? types, bool allowPrefixLookup) { bool prefixLookup, ignoreCase; MemberListType listType; FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType); RuntimePropertyInfo[] cache = GetPropertiesByName(name, bindingAttr, listType, this); bindingAttr ^= BindingFlags.DeclaredOnly; ListBuilder<PropertyInfo> candidates = new ListBuilder<PropertyInfo>(cache.Length); for (int i = 0; i < cache.Length; i++) { RuntimePropertyInfo propertyInfo = cache[i]; if ((bindingAttr & propertyInfo.BindingFlags) == propertyInfo.BindingFlags && (!prefixLookup || FilterApplyPrefixLookup(propertyInfo, name, ignoreCase)) && (types == null || (propertyInfo.GetIndexParameters().Length == types.Length))) { candidates.Add(propertyInfo); } } return candidates; } private ListBuilder<EventInfo> GetEventCandidates(string? name, BindingFlags bindingAttr, bool allowPrefixLookup) { bool prefixLookup, ignoreCase; MemberListType listType; FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType); RuntimeEventInfo[] cache = GetEvents_internal(name, listType, this); bindingAttr ^= BindingFlags.DeclaredOnly; ListBuilder<EventInfo> candidates = new ListBuilder<EventInfo>(cache.Length); for (int i = 0; i < cache.Length; i++) { RuntimeEventInfo eventInfo = cache[i]; if ((bindingAttr & eventInfo.BindingFlags) == eventInfo.BindingFlags && (!prefixLookup || FilterApplyPrefixLookup(eventInfo, name, ignoreCase))) { candidates.Add(eventInfo); } } return candidates; } private ListBuilder<FieldInfo> GetFieldCandidates(string? name, BindingFlags bindingAttr, bool allowPrefixLookup) { bool prefixLookup, ignoreCase; MemberListType listType; FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType); RuntimeFieldInfo[] cache = GetFields_internal(name, bindingAttr, listType, this); bindingAttr ^= BindingFlags.DeclaredOnly; ListBuilder<FieldInfo> candidates = new ListBuilder<FieldInfo>(cache.Length); for (int i = 0; i < cache.Length; i++) { RuntimeFieldInfo fieldInfo = cache[i]; if ((!prefixLookup || FilterApplyPrefixLookup(fieldInfo, name, ignoreCase))) { candidates.Add(fieldInfo); } } return candidates; } private ListBuilder<Type> GetNestedTypeCandidates(string? fullname, BindingFlags bindingAttr, bool allowPrefixLookup) { bool prefixLookup, ignoreCase; bindingAttr &= ~BindingFlags.Static; string? name, ns; MemberListType listType; SplitName(fullname, out name, out ns); FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType); RuntimeType[] cache = GetNestedTypes_internal(name, bindingAttr, listType); ListBuilder<Type> candidates = new ListBuilder<Type>(cache.Length); for (int i = 0; i < cache.Length; i++) { RuntimeType nestedClass = cache[i]; if (FilterApplyType(nestedClass, bindingAttr, name, prefixLookup, ns)) { candidates.Add(nestedClass); } } return candidates; } #endregion #region Get All XXXInfos [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] public override MethodInfo[] GetMethods(BindingFlags bindingAttr) { return GetMethodCandidates(null, bindingAttr, CallingConventions.Any, null, -1, false).ToArray(); } [ComVisible(true)] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) { return GetConstructorCandidates(null, bindingAttr, CallingConventions.Any, null, false).ToArray(); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) { return GetPropertyCandidates(null, bindingAttr, null, false).ToArray(); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)] public override EventInfo[] GetEvents(BindingFlags bindingAttr) { return GetEventCandidates(null, bindingAttr, false).ToArray(); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] public override FieldInfo[] GetFields(BindingFlags bindingAttr) { return GetFieldCandidates(null, bindingAttr, false).ToArray(); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes)] public override Type[] GetNestedTypes(BindingFlags bindingAttr) { return GetNestedTypeCandidates(null, bindingAttr, false).ToArray(); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { ListBuilder<MethodInfo> methods = GetMethodCandidates(null, bindingAttr, CallingConventions.Any, null, -1, false); ListBuilder<ConstructorInfo> constructors = GetConstructorCandidates(null, bindingAttr, CallingConventions.Any, null, false); ListBuilder<PropertyInfo> properties = GetPropertyCandidates(null, bindingAttr, null, false); ListBuilder<EventInfo> events = GetEventCandidates(null, bindingAttr, false); ListBuilder<FieldInfo> fields = GetFieldCandidates(null, bindingAttr, false); ListBuilder<Type> nestedTypes = GetNestedTypeCandidates(null, bindingAttr, false); // Interfaces are excluded from the result of GetMembers MemberInfo[] members = new MemberInfo[ methods.Count + constructors.Count + properties.Count + events.Count + fields.Count + nestedTypes.Count]; int i = 0; methods.CopyTo(members, i); i += methods.Count; constructors.CopyTo(members, i); i += constructors.Count; properties.CopyTo(members, i); i += properties.Count; events.CopyTo(members, i); i += events.Count; fields.CopyTo(members, i); i += fields.Count; nestedTypes.CopyTo(members, i); i += nestedTypes.Count; Debug.Assert(i == members.Length); return members; } #endregion [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) { return GetMethodImpl(name, -1, bindingAttr, binder, callConvention, types, modifiers); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] protected override MethodInfo? GetMethodImpl(string name, int genericParamCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConv, Type[]? types, ParameterModifier[]? modifiers) { ListBuilder<MethodInfo> candidates = GetMethodCandidates(name, bindingAttr, callConv, types, genericParamCount, false); if (candidates.Count == 0) return null; if (types == null || types.Length == 0) { MethodInfo firstCandidate = candidates[0]; if (candidates.Count == 1) { return firstCandidate; } else if (types == null) { for (int j = 1; j < candidates.Count; j++) { MethodInfo methodInfo = candidates[j]; if (!System.DefaultBinder.CompareMethodSig(methodInfo, firstCandidate)) throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException")); } // All the methods have the exact same name and sig so return the most derived one. return System.DefaultBinder.FindMostDerivedNewSlotMeth(candidates.ToArray(), candidates.Count) as MethodInfo; } } if (binder == null) binder = DefaultBinder; return binder.SelectMethod(bindingAttr, candidates.ToArray(), types, modifiers) as MethodInfo; } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] protected override ConstructorInfo? GetConstructorImpl( BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) { ListBuilder<ConstructorInfo> candidates = GetConstructorCandidates(null, bindingAttr, CallingConventions.Any, types, false); if (candidates.Count == 0) return null; if (types.Length == 0 && candidates.Count == 1) { ConstructorInfo firstCandidate = candidates[0]; ParameterInfo[] parameters = firstCandidate.GetParametersNoCopy(); if (parameters == null || parameters.Length == 0) { return firstCandidate; } } if ((bindingAttr & BindingFlags.ExactBinding) != 0) return System.DefaultBinder.ExactBinding(candidates.ToArray(), types, modifiers) as ConstructorInfo; if (binder == null) binder = DefaultBinder; return binder.SelectMethod(bindingAttr, candidates.ToArray(), types, modifiers) as ConstructorInfo; } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] protected override PropertyInfo? GetPropertyImpl( string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) { if (name == null) throw new ArgumentNullException(nameof(name)); ListBuilder<PropertyInfo> candidates = GetPropertyCandidates(name, bindingAttr, types, false); if (candidates.Count == 0) return null; if (types == null || types.Length == 0) { // no arguments if (candidates.Count == 1) { PropertyInfo firstCandidate = candidates[0]; if (returnType is not null && !returnType.IsEquivalentTo(firstCandidate.PropertyType)) return null; return firstCandidate; } else { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException")); } } if ((bindingAttr & BindingFlags.ExactBinding) != 0) return System.DefaultBinder.ExactPropertyBinding(candidates.ToArray(), returnType, types, modifiers); if (binder == null) binder = DefaultBinder; return binder.SelectProperty(bindingAttr, candidates.ToArray(), returnType, types, modifiers); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)] public override EventInfo? GetEvent(string name, BindingFlags bindingAttr) { if (name == null) throw new ArgumentNullException(nameof(name)); bool ignoreCase; MemberListType listType; FilterHelper(bindingAttr, ref name!, out ignoreCase, out listType); RuntimeEventInfo[] cache = GetEvents_internal(name, listType, this); EventInfo? match = null; bindingAttr ^= BindingFlags.DeclaredOnly; for (int i = 0; i < cache.Length; i++) { RuntimeEventInfo eventInfo = cache[i]; if ((bindingAttr & eventInfo.BindingFlags) == eventInfo.BindingFlags) { if (match != null) throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException")); match = eventInfo; } } return match; } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] public override FieldInfo? GetField(string name, BindingFlags bindingAttr) { if (name == null) throw new ArgumentNullException(); bool ignoreCase; MemberListType listType; FilterHelper(bindingAttr, ref name!, out ignoreCase, out listType); RuntimeFieldInfo[] cache = GetFields_internal(name, bindingAttr, listType, this); FieldInfo? match = null; bindingAttr ^= BindingFlags.DeclaredOnly; bool multipleStaticFieldMatches = false; for (int i = 0; i < cache.Length; i++) { RuntimeFieldInfo fieldInfo = cache[i]; { if (match != null) { if (ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException")); if ((match.DeclaringType!.IsInterface == true) && (fieldInfo.DeclaringType!.IsInterface == true)) multipleStaticFieldMatches = true; } if (match == null || fieldInfo.DeclaringType!.IsSubclassOf(match.DeclaringType!) || match.DeclaringType!.IsInterface) match = fieldInfo; } } if (multipleStaticFieldMatches && match!.DeclaringType!.IsInterface) throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException")); return match; } public override Type? GetInterface(string fullname, bool ignoreCase) { if (fullname == null) throw new ArgumentNullException(nameof(fullname)); BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.NonPublic; bindingAttr &= ~BindingFlags.Static; if (ignoreCase) bindingAttr |= BindingFlags.IgnoreCase; string? name, ns; MemberListType listType; SplitName(fullname, out name, out ns); FilterHelper(bindingAttr, ref name, out ignoreCase, out listType); List<RuntimeType>? list = null; StringComparison nameComparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; foreach (RuntimeType t in GetInterfaces()) { if (!string.Equals(t.Name, name, nameComparison)) { continue; } if (list == null) list = new List<RuntimeType>(2); list.Add(t); } if (list == null) return null; RuntimeType[]? cache = list.ToArray(); RuntimeType? match = null; for (int i = 0; i < cache.Length; i++) { RuntimeType iface = cache[i]; if (FilterApplyType(iface, bindingAttr, name, false, ns)) { if (match != null) throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException")); match = iface; } } return match; } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes)] public override Type? GetNestedType(string fullname, BindingFlags bindingAttr) { if (fullname == null) throw new ArgumentNullException(nameof(fullname)); bool ignoreCase; bindingAttr &= ~BindingFlags.Static; string? name, ns; MemberListType listType; SplitName(fullname, out name, out ns); FilterHelper(bindingAttr, ref name, out ignoreCase, out listType); RuntimeType[] cache = GetNestedTypes_internal(name, bindingAttr, listType); RuntimeType? match = null; for (int i = 0; i < cache.Length; i++) { RuntimeType nestedType = cache[i]; if (FilterApplyType(nestedType, bindingAttr, name, false, ns)) { if (match != null) throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException")); match = nestedType; } } return match; } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] public override MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr) { if (name == null) throw new ArgumentNullException(nameof(name)); ListBuilder<MethodInfo> methods = default; ListBuilder<ConstructorInfo> constructors = default; ListBuilder<PropertyInfo> properties = default; ListBuilder<EventInfo> events = default; ListBuilder<FieldInfo> fields = default; ListBuilder<Type> nestedTypes = default; int totalCount = 0; // Methods if ((type & MemberTypes.Method) != 0) { methods = GetMethodCandidates(name, bindingAttr, CallingConventions.Any, null, -1, true); if (type == MemberTypes.Method) return methods.ToArray(); totalCount += methods.Count; } // Constructors if ((type & MemberTypes.Constructor) != 0) { constructors = GetConstructorCandidates(name, bindingAttr, CallingConventions.Any, null, true); if (type == MemberTypes.Constructor) return constructors.ToArray(); totalCount += constructors.Count; } // Properties if ((type & MemberTypes.Property) != 0) { properties = GetPropertyCandidates(name, bindingAttr, null, true); if (type == MemberTypes.Property) return properties.ToArray(); totalCount += properties.Count; } // Events if ((type & MemberTypes.Event) != 0) { events = GetEventCandidates(name, bindingAttr, true); if (type == MemberTypes.Event) return events.ToArray(); totalCount += events.Count; } // Fields if ((type & MemberTypes.Field) != 0) { fields = GetFieldCandidates(name, bindingAttr, true); if (type == MemberTypes.Field) return fields.ToArray(); totalCount += fields.Count; } // NestedTypes if ((type & (MemberTypes.NestedType | MemberTypes.TypeInfo)) != 0) { nestedTypes = GetNestedTypeCandidates(name, bindingAttr, true); if (type == MemberTypes.NestedType || type == MemberTypes.TypeInfo) return nestedTypes.ToArray(); totalCount += nestedTypes.Count; } MemberInfo[] compressMembers = (type == (MemberTypes.Method | MemberTypes.Constructor)) ? new MethodBase[totalCount] : new MemberInfo[totalCount]; int i = 0; methods.CopyTo(compressMembers, i); i += methods.Count; constructors.CopyTo(compressMembers, i); i += constructors.Count; properties.CopyTo(compressMembers, i); i += properties.Count; events.CopyTo(compressMembers, i); i += events.Count; fields.CopyTo(compressMembers, i); i += fields.Count; nestedTypes.CopyTo(compressMembers, i); i += nestedTypes.Count; Debug.Assert(i == compressMembers.Length); return compressMembers; } #endregion #region Hierarchy // Reflexive, symmetric, transitive. public override bool IsEquivalentTo(Type? other) { RuntimeType? otherRtType = other as RuntimeType; if (otherRtType is null) return false; if (otherRtType == this) return true; // It's not worth trying to perform further checks in managed // as they would lead to FCalls anyway. return RuntimeTypeHandle.IsEquivalentTo(this, otherRtType); } #endregion #region Attributes internal bool IsDelegate() { return GetBaseType() == typeof(System.MulticastDelegate); } public override bool IsEnum => GetBaseType() == EnumType; public override GenericParameterAttributes GenericParameterAttributes { get { if (!IsGenericParameter) throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter")); return GetGenericParameterAttributes(); } } #endregion #region Generics internal RuntimeType[] GetGenericArgumentsInternal() { return (RuntimeType[])GetGenericArgumentsInternal(true); } public override Type[] GetGenericArguments() { Type[] types = GetGenericArgumentsInternal(false); if (types == null) types = Type.EmptyTypes; return types; } public override Type MakeGenericType(Type[] instantiation) { if (instantiation == null) throw new ArgumentNullException(nameof(instantiation)); RuntimeType[] instantiationRuntimeType = new RuntimeType[instantiation.Length]; if (!IsGenericTypeDefinition) throw new InvalidOperationException( Environment.GetResourceString("Arg_NotGenericTypeDefinition", this)); if (GetGenericArguments().Length != instantiation.Length) throw new ArgumentException(Environment.GetResourceString("Argument_GenericArgsCount"), nameof(instantiation)); for (int i = 0; i < instantiation.Length; i++) { Type instantiationElem = instantiation[i]; if (instantiationElem == null) throw new ArgumentNullException(); RuntimeType? rtInstantiationElem = instantiationElem as RuntimeType; if (rtInstantiationElem == null) { if (instantiationElem.IsSignatureType) return MakeGenericSignatureType(this, instantiation); Type[] instantiationCopy = new Type[instantiation.Length]; for (int iCopy = 0; iCopy < instantiation.Length; iCopy++) instantiationCopy[iCopy] = instantiation[iCopy]; instantiation = instantiationCopy; throw new NotImplementedException(); } instantiationRuntimeType[i] = rtInstantiationElem; } RuntimeType[] genericParameters = GetGenericArgumentsInternal(); SanityCheckGenericArguments(instantiationRuntimeType, genericParameters); Type? ret = MakeGenericType(this, instantiationRuntimeType); if (ret == null) throw new TypeLoadException(); return ret; } public override int GenericParameterPosition { get { if (!IsGenericParameter) throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter")); return GetGenericParameterPosition(); } } #endregion #region Invoke Member private const BindingFlags MemberBindingMask = (BindingFlags)0x000000FF; private const BindingFlags InvocationMask = (BindingFlags)0x0000FF00; private const BindingFlags BinderNonCreateInstance = BindingFlags.InvokeMethod | BinderGetSetField | BinderGetSetProperty; private const BindingFlags BinderGetSetProperty = BindingFlags.GetProperty | BindingFlags.SetProperty; private const BindingFlags BinderGetSetField = BindingFlags.GetField | BindingFlags.SetField; private const BindingFlags BinderNonFieldGetSet = (BindingFlags)0x00FFF300; [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] public override object? InvokeMember( string name, BindingFlags bindingFlags, Binder? binder, object? target, object?[]? providedArgs, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParams) { if (IsGenericParameter) throw new InvalidOperationException(Environment.GetResourceString("Arg_GenericParameter")); #region Preconditions if ((bindingFlags & InvocationMask) == 0) // "Must specify binding flags describing the invoke operation required." throw new ArgumentException(Environment.GetResourceString("Arg_NoAccessSpec"), nameof(bindingFlags)); // Provide a default binding mask if none is provided if ((bindingFlags & MemberBindingMask) == 0) { bindingFlags |= BindingFlags.Instance | BindingFlags.Public; if ((bindingFlags & BindingFlags.CreateInstance) == 0) bindingFlags |= BindingFlags.Static; } // There must not be more named parameters than provided arguments if (namedParams != null) { if (providedArgs != null) { if (namedParams.Length > providedArgs.Length) // "Named parameter array can not be bigger than argument array." throw new ArgumentException(Environment.GetResourceString("Arg_NamedParamTooBig"), nameof(namedParams)); } else { if (namedParams.Length != 0) // "Named parameter array can not be bigger than argument array." throw new ArgumentException(Environment.GetResourceString("Arg_NamedParamTooBig"), nameof(namedParams)); } } #endregion #region Check that any named paramters are not null if (namedParams != null && Array.IndexOf<string?>(namedParams, null) != -1) // "Named parameter value must not be null." throw new ArgumentException(Environment.GetResourceString("Arg_NamedParamNull"), nameof(namedParams)); #endregion int argCnt = (providedArgs != null) ? providedArgs.Length : 0; #region Get a Binder if (binder == null) binder = DefaultBinder; #endregion #region Delegate to Activator.CreateInstance if ((bindingFlags & BindingFlags.CreateInstance) != 0) { if ((bindingFlags & BindingFlags.CreateInstance) != 0 && (bindingFlags & BinderNonCreateInstance) != 0) // "Can not specify both CreateInstance and another access type." throw new ArgumentException(Environment.GetResourceString("Arg_CreatInstAccess"), nameof(bindingFlags)); return Activator.CreateInstance(this, bindingFlags, binder, providedArgs, culture); } #endregion // PutDispProperty and\or PutRefDispProperty ==> SetProperty. if ((bindingFlags & (BindingFlags.PutDispProperty | BindingFlags.PutRefDispProperty)) != 0) bindingFlags |= BindingFlags.SetProperty; #region Name if (name == null) throw new ArgumentNullException(nameof(name)); if (name.Length == 0 || name.Equals(@"[DISPID=0]")) { name = GetDefaultMemberName() ?? "ToString"; // in InvokeMember we always pretend there is a default member if none is provided and we make it ToString } #endregion #region GetField or SetField bool IsGetField = (bindingFlags & BindingFlags.GetField) != 0; bool IsSetField = (bindingFlags & BindingFlags.SetField) != 0; if (IsGetField || IsSetField) { #region Preconditions if (IsGetField) { if (IsSetField) // "Can not specify both Get and Set on a field." throw new ArgumentException(Environment.GetResourceString("Arg_FldSetGet"), nameof(bindingFlags)); if ((bindingFlags & BindingFlags.SetProperty) != 0) // "Can not specify both GetField and SetProperty." throw new ArgumentException(Environment.GetResourceString("Arg_FldGetPropSet"), nameof(bindingFlags)); } else { Debug.Assert(IsSetField); if (providedArgs == null) throw new ArgumentNullException(nameof(providedArgs)); if ((bindingFlags & BindingFlags.GetProperty) != 0) // "Can not specify both SetField and GetProperty." throw new ArgumentException(Environment.GetResourceString("Arg_FldSetPropGet"), nameof(bindingFlags)); if ((bindingFlags & BindingFlags.InvokeMethod) != 0) // "Can not specify Set on a Field and Invoke on a method." throw new ArgumentException(Environment.GetResourceString("Arg_FldSetInvoke"), nameof(bindingFlags)); } #endregion #region Lookup Field FieldInfo? selFld = null; FieldInfo[]? flds = GetMember(name, MemberTypes.Field, bindingFlags) as FieldInfo[]; Debug.Assert(flds != null); if (flds.Length == 1) { selFld = flds[0]; } else if (flds.Length > 0) { selFld = binder.BindToField(bindingFlags, flds, IsGetField ? Empty.Value : providedArgs![0]!, culture); } #endregion if (selFld != null) { #region Invocation on a field if (selFld.FieldType.IsArray || ReferenceEquals(selFld.FieldType, typeof(System.Array))) { #region Invocation of an array Field int idxCnt; if ((bindingFlags & BindingFlags.GetField) != 0) { idxCnt = argCnt; } else { idxCnt = argCnt - 1; } if (idxCnt > 0) { // Verify that all of the index values are ints int[] idx = new int[idxCnt]; for (int i = 0; i < idxCnt; i++) { try { idx[i] = ((IConvertible)providedArgs![i]!).ToInt32(null); } catch (InvalidCastException) { throw new ArgumentException(Environment.GetResourceString("Arg_IndexMustBeInt")); } } // Set or get the value... Array a = (Array)selFld.GetValue(target)!; // Set or get the value in the array if ((bindingFlags & BindingFlags.GetField) != 0) { return a.GetValue(idx); } else { a.SetValue(providedArgs![idxCnt], idx); return null; } } #endregion } if (IsGetField) { #region Get the field value if (argCnt != 0) throw new ArgumentException(Environment.GetResourceString("Arg_FldGetArgErr"), nameof(bindingFlags)); return selFld.GetValue(target); #endregion } else { #region Set the field Value if (argCnt != 1) throw new ArgumentException(Environment.GetResourceString("Arg_FldSetArgErr"), nameof(bindingFlags)); selFld.SetValue(target, providedArgs![0], bindingFlags, binder, culture); return null; #endregion } #endregion } if ((bindingFlags & BinderNonFieldGetSet) == 0) throw new MissingFieldException(FullName, name); } #endregion #region Caching Logic /* bool useCache = false; // Note that when we add something to the cache, we are careful to ensure // that the actual providedArgs matches the parameters of the method. Otherwise, // some default argument processing has occurred. We don't want anyone // else with the same (insufficient) number of actual arguments to get a // cache hit because then they would bypass the default argument processing // and the invocation would fail. if (bDefaultBinder && namedParams == null && argCnt < 6) useCache = true; if (useCache) { MethodBase invokeMethod = GetMethodFromCache (name, bindingFlags, argCnt, providedArgs); if (invokeMethod != null) return ((MethodInfo) invokeMethod).Invoke(target, bindingFlags, binder, providedArgs, culture); } */ #endregion #region Property PreConditions // @Legacy - This is RTM behavior bool isGetProperty = (bindingFlags & BindingFlags.GetProperty) != 0; bool isSetProperty = (bindingFlags & BindingFlags.SetProperty) != 0; if (isGetProperty || isSetProperty) { #region Preconditions if (isGetProperty) { Debug.Assert(!IsSetField); if (isSetProperty) throw new ArgumentException(Environment.GetResourceString("Arg_PropSetGet"), nameof(bindingFlags)); } else { Debug.Assert(isSetProperty); Debug.Assert(!IsGetField); if ((bindingFlags & BindingFlags.InvokeMethod) != 0) throw new ArgumentException(Environment.GetResourceString("Arg_PropSetInvoke"), nameof(bindingFlags)); } #endregion } #endregion MethodInfo[]? finalists = null; MethodInfo? finalist = null; #region BindingFlags.InvokeMethod if ((bindingFlags & BindingFlags.InvokeMethod) != 0) { #region Lookup Methods MethodInfo[] semiFinalists = (GetMember(name, MemberTypes.Method, bindingFlags) as MethodInfo[])!; List<MethodInfo>? results = null; for (int i = 0; i < semiFinalists.Length; i++) { MethodInfo semiFinalist = semiFinalists[i]; Debug.Assert(semiFinalist != null); if (!FilterApplyMethodInfo((RuntimeMethodInfo)semiFinalist, bindingFlags, CallingConventions.Any, new Type[argCnt])) continue; if (finalist == null) { finalist = semiFinalist; } else { results ??= new List<MethodInfo>(semiFinalists.Length) { finalist }; results.Add(semiFinalist); } } if (results != null) { Debug.Assert(results.Count > 1); finalists = new MethodInfo[results.Count]; results.CopyTo(finalists); } #endregion } #endregion Debug.Assert(finalists == null || finalist != null); #region BindingFlags.GetProperty or BindingFlags.SetProperty if (finalist == null && isGetProperty || isSetProperty) { #region Lookup Property PropertyInfo[] semiFinalists = (GetMember(name, MemberTypes.Property, bindingFlags) as PropertyInfo[])!; List<MethodInfo>? results = null; for (int i = 0; i < semiFinalists.Length; i++) { MethodInfo? semiFinalist = null; if (isSetProperty) { semiFinalist = semiFinalists[i].GetSetMethod(true); } else { semiFinalist = semiFinalists[i].GetGetMethod(true); } if (semiFinalist == null) continue; if (!FilterApplyMethodInfo((RuntimeMethodInfo)semiFinalist, bindingFlags, CallingConventions.Any, new Type[argCnt])) continue; if (finalist == null) { finalist = semiFinalist; } else { results ??= new List<MethodInfo>(semiFinalists.Length) { finalist }; results.Add(semiFinalist); } } if (results != null) { Debug.Assert(results.Count > 1); finalists = new MethodInfo[results.Count]; results.CopyTo(finalists); } #endregion } #endregion if (finalist != null) { #region Invoke if (finalists == null && argCnt == 0 && finalist.GetParametersNoCopy().Length == 0 && (bindingFlags & BindingFlags.OptionalParamBinding) == 0) { //if (useCache && argCnt == props[0].GetParameters().Length) // AddMethodToCache(name, bindingFlags, argCnt, providedArgs, props[0]); return finalist.Invoke(target, bindingFlags, binder, providedArgs, culture); } finalists ??= new MethodInfo[] { finalist }; providedArgs ??= Array.Empty<object>(); object? state = null; MethodBase? invokeMethod = null; try { invokeMethod = binder.BindToMethod(bindingFlags, finalists, ref providedArgs, modifiers, culture, namedParams, out state); } catch (MissingMethodException) { } if (invokeMethod == null) throw new MissingMethodException(FullName, name); //if (useCache && argCnt == invokeMethod.GetParameters().Length) // AddMethodToCache(name, bindingFlags, argCnt, providedArgs, invokeMethod); object? result = ((MethodInfo)invokeMethod).Invoke(target, bindingFlags, binder, providedArgs, culture); if (state != null) binder.ReorderArgumentArray(ref providedArgs, state); return result; #endregion } throw new MissingMethodException(FullName, name); } #endregion public static bool operator ==(RuntimeType? left, RuntimeType? right) { return ReferenceEquals(left, right); } public static bool operator !=(RuntimeType? left, RuntimeType? right) { return !ReferenceEquals(left, right); } #region Legacy Internal private void CreateInstanceCheckThis() { if (ContainsGenericParameters) throw new ArgumentException( Environment.GetResourceString("Acc_CreateGenericEx", this)); Type elementType = this.GetRootElementType(); if (ReferenceEquals(elementType, typeof(ArgIterator))) throw new NotSupportedException(Environment.GetResourceString("Acc_CreateArgIterator")); if (ReferenceEquals(elementType, typeof(void))) throw new NotSupportedException(Environment.GetResourceString("Acc_CreateVoid")); } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2082:UnrecognizedReflectionPattern", Justification = "Implementation detail of Activator that linker intrinsically recognizes")] [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "Implementation detail of Activator that linker intrinsically recognizes")] internal object? CreateInstanceImpl( BindingFlags bindingAttr, Binder? binder, object?[]? args, CultureInfo? culture) { CreateInstanceCheckThis(); object? server = null; try { try { args ??= Array.Empty<object>(); int argCnt = args.Length; // Without a binder we need to do use the default binder... if (binder == null) binder = DefaultBinder; // deal with the __COMObject case first. It is very special because from a reflection point of view it has no ctors // so a call to GetMemberCons would fail bool publicOnly = (bindingAttr & BindingFlags.NonPublic) == 0; bool wrapExceptions = (bindingAttr & BindingFlags.DoNotWrapExceptions) == 0; if (argCnt == 0 && (bindingAttr & BindingFlags.Public) != 0 && (bindingAttr & BindingFlags.Instance) != 0 && (IsValueType)) { server = CreateInstanceDefaultCtor(publicOnly, wrapExceptions); } else { ConstructorInfo[] candidates = GetConstructors(bindingAttr); List<MethodBase> matches = new List<MethodBase>(candidates.Length); // We cannot use Type.GetTypeArray here because some of the args might be null Type[] argsType = new Type[argCnt]; for (int i = 0; i < argCnt; i++) { if (args[i] != null) { argsType[i] = args[i]!.GetType(); } } for (int i = 0; i < candidates.Length; i++) { if (FilterApplyConstructorInfo((RuntimeConstructorInfo)candidates[i], bindingAttr, CallingConventions.Any, argsType)) matches.Add(candidates[i]); } MethodBase[]? cons = new MethodBase[matches.Count]; matches.CopyTo(cons); if (cons != null && cons.Length == 0) cons = null; if (cons == null) { throw new MissingMethodException(Environment.GetResourceString("MissingConstructor_Name", FullName)); } MethodBase? invokeMethod; object? state = null; try { invokeMethod = binder.BindToMethod(bindingAttr, cons, ref args, null, culture, null, out state); } catch (MissingMethodException) { invokeMethod = null; } if (invokeMethod == null) { throw new MissingMethodException(Environment.GetResourceString("MissingConstructor_Name", FullName)); } if (invokeMethod.GetParametersNoCopy().Length == 0) { if (args.Length != 0) { Debug.Assert((invokeMethod.CallingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs); throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("NotSupported_CallToVarArg"))); } // fast path?? server = Activator.CreateInstance(this, nonPublic: true, wrapExceptions: wrapExceptions); } else { server = ((ConstructorInfo)invokeMethod).Invoke(bindingAttr, binder, args, culture); if (state != null) binder.ReorderArgumentArray(ref args, state); } } } finally { } } catch (Exception) { throw; } //Console.WriteLine(server); return server; } // Helper to invoke the default (parameterless) ctor. [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] internal object? CreateInstanceDefaultCtor(bool publicOnly, bool wrapExceptions) { if (IsByRefLike) throw new NotSupportedException(SR.NotSupported_ByRefLike); CreateInstanceCheckThis(); return CreateInstanceMono(!publicOnly, wrapExceptions); } #endregion private TypeCache? cache; internal TypeCache Cache => Volatile.Read(ref cache) ?? Interlocked.CompareExchange(ref cache, new TypeCache(), null) ?? cache; internal sealed class TypeCache { public Enum.EnumInfo? EnumInfo; public TypeCode TypeCode; // this is the displayed form: special characters // ,+*&*[]\ in the identifier portions of the names // have been escaped with a leading backslash (\) public string? full_name; public bool default_ctor_cached; public RuntimeConstructorInfo? default_ctor; } internal RuntimeType(object obj) { throw new NotImplementedException(); } internal RuntimeConstructorInfo? GetDefaultConstructor() { TypeCache? cache = Cache; RuntimeConstructorInfo? ctor = null; if (Volatile.Read(ref cache.default_ctor_cached)) return cache.default_ctor; ListBuilder<ConstructorInfo> ctors = GetConstructorCandidates( null, BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly, CallingConventions.Any, Type.EmptyTypes, false); if (ctors.Count == 1) cache.default_ctor = ctor = (RuntimeConstructorInfo)ctors[0]; // Note down even if we found no constructors Volatile.Write(ref cache.default_ctor_cached, true); return ctor; } [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern MethodInfo GetCorrespondingInflatedMethod(MethodInfo generic); [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern ConstructorInfo GetCorrespondingInflatedConstructor(ConstructorInfo generic); internal override MethodInfo GetMethod(MethodInfo fromNoninstanciated) { if (fromNoninstanciated == null) throw new ArgumentNullException(nameof(fromNoninstanciated)); return GetCorrespondingInflatedMethod(fromNoninstanciated); } internal override ConstructorInfo GetConstructor(ConstructorInfo fromNoninstanciated) { if (fromNoninstanciated == null) throw new ArgumentNullException(nameof(fromNoninstanciated)); return GetCorrespondingInflatedConstructor(fromNoninstanciated); } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "We already have a FieldInfo so this will succeed")] internal override FieldInfo GetField(FieldInfo fromNoninstanciated) { /* create sensible flags from given FieldInfo */ BindingFlags flags = fromNoninstanciated.IsStatic ? BindingFlags.Static : BindingFlags.Instance; flags |= fromNoninstanciated.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic; return GetField(fromNoninstanciated.Name, flags)!; } private string? GetDefaultMemberName() { object[] att = GetCustomAttributes(typeof(DefaultMemberAttribute), true); return att.Length != 0 ? ((DefaultMemberAttribute)att[0]).MemberName : null; } private RuntimeConstructorInfo? m_serializationCtor; internal RuntimeConstructorInfo? GetSerializationCtor() { if (m_serializationCtor == null) { var s_SICtorParamTypes = new Type[] { typeof(SerializationInfo), typeof(StreamingContext) }; m_serializationCtor = GetConstructor( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, CallingConventions.Any, s_SICtorParamTypes, null) as RuntimeConstructorInfo; } return m_serializationCtor; } private object? CreateInstanceMono(bool nonPublic, bool wrapExceptions) { RuntimeConstructorInfo? ctor = GetDefaultConstructor(); if (!nonPublic && ctor != null && !ctor.IsPublic) { throw new MissingMethodException(SR.Format(SR.Arg_NoDefCTor, FullName)); } if (ctor == null) { Type elementType = this.GetRootElementType(); if (ReferenceEquals(elementType, typeof(TypedReference)) || ReferenceEquals(elementType, typeof(RuntimeArgumentHandle))) throw new NotSupportedException(Environment.GetResourceString("NotSupported_ContainsStackPtr")); if (IsValueType) return CreateInstanceInternal(this); throw new MissingMethodException("Default constructor not found for type " + FullName); } // TODO: .net does more checks in unmanaged land in RuntimeTypeHandle::CreateInstance if (IsAbstract) { throw new MissingMethodException("Cannot create an abstract class '{0}'.", FullName); } return ctor.InternalInvoke(null, null, wrapExceptions); } internal object? CheckValue(object? value, Binder binder, CultureInfo? culture, BindingFlags invokeAttr) { bool failed = false; object? res = TryConvertToType(value, ref failed); if (!failed) return res; if ((invokeAttr & BindingFlags.ExactBinding) == BindingFlags.ExactBinding) throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value!.GetType(), this)); if (binder != null && binder != DefaultBinder) return binder.ChangeType(value!, this, culture); throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value!.GetType(), this)); } private object? TryConvertToType(object? value, ref bool failed) { if (IsInstanceOfType(value)) { return value; } if (IsByRef) { Type? elementType = GetElementType(); if (value == null || elementType.IsInstanceOfType(value)) { return value; } } if (value == null) return value; if (IsEnum) { Type? type = Enum.GetUnderlyingType(this); if (type == value.GetType()) return value; object? res = IsConvertibleToPrimitiveType(value, type); if (res != null) return res; } else if (IsPrimitive) { object? res = IsConvertibleToPrimitiveType(value, this); if (res != null) return res; } else if (IsPointer) { Type? vtype = value.GetType(); if (vtype == typeof(IntPtr) || vtype == typeof(UIntPtr)) return value; if (value is Pointer pointer) { Type pointerType = pointer.GetPointerType(); if (pointerType == this) return pointer.GetPointerValue(); } } failed = true; return null; } // Binder uses some incompatible conversion rules. For example // int value cannot be used with decimal parameter but in other // ways it's more flexible than normal convertor, for example // long value can be used with int based enum private static object? IsConvertibleToPrimitiveType(object value, Type targetType) { Type? type = value.GetType(); if (type.IsEnum) { type = Enum.GetUnderlyingType(type); if (type == targetType) return value; } TypeCode from = GetTypeCode(type); TypeCode to = GetTypeCode(targetType); switch (to) { case TypeCode.Char: switch (from) { case TypeCode.Byte: return (char)(byte)value; case TypeCode.UInt16: return value; } break; case TypeCode.Int16: switch (from) { case TypeCode.Byte: return (short)(byte)value; case TypeCode.SByte: return (short)(sbyte)value; } break; case TypeCode.UInt16: switch (from) { case TypeCode.Byte: return (ushort)(byte)value; case TypeCode.Char: return value; } break; case TypeCode.Int32: switch (from) { case TypeCode.Byte: return (int)(byte)value; case TypeCode.SByte: return (int)(sbyte)value; case TypeCode.Char: return (int)(char)value; case TypeCode.Int16: return (int)(short)value; case TypeCode.UInt16: return (int)(ushort)value; } break; case TypeCode.UInt32: switch (from) { case TypeCode.Byte: return (uint)(byte)value; case TypeCode.Char: return (uint)(char)value; case TypeCode.UInt16: return (uint)(ushort)value; } break; case TypeCode.Int64: switch (from) { case TypeCode.Byte: return (long)(byte)value; case TypeCode.SByte: return (long)(sbyte)value; case TypeCode.Int16: return (long)(short)value; case TypeCode.Char: return (long)(char)value; case TypeCode.UInt16: return (long)(ushort)value; case TypeCode.Int32: return (long)(int)value; case TypeCode.UInt32: return (long)(uint)value; } break; case TypeCode.UInt64: switch (from) { case TypeCode.Byte: return (ulong)(byte)value; case TypeCode.Char: return (ulong)(char)value; case TypeCode.UInt16: return (ulong)(ushort)value; case TypeCode.UInt32: return (ulong)(uint)value; } break; case TypeCode.Single: switch (from) { case TypeCode.Byte: return (float)(byte)value; case TypeCode.SByte: return (float)(sbyte)value; case TypeCode.Int16: return (float)(short)value; case TypeCode.Char: return (float)(char)value; case TypeCode.UInt16: return (float)(ushort)value; case TypeCode.Int32: return (float)(int)value; case TypeCode.UInt32: return (float)(uint)value; case TypeCode.Int64: return (float)(long)value; case TypeCode.UInt64: return (float)(ulong)value; } break; case TypeCode.Double: switch (from) { case TypeCode.Byte: return (double)(byte)value; case TypeCode.SByte: return (double)(sbyte)value; case TypeCode.Char: return (double)(char)value; case TypeCode.Int16: return (double)(short)value; case TypeCode.UInt16: return (double)(ushort)value; case TypeCode.Int32: return (double)(int)value; case TypeCode.UInt32: return (double)(uint)value; case TypeCode.Int64: return (double)(long)value; case TypeCode.UInt64: return (double)(ulong)value; case TypeCode.Single: return (double)(float)value; } break; } // Everything else is rejected return null; } [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Type make_array_type(int rank); public override Type MakeArrayType() { return make_array_type(0); } public override Type MakeArrayType(int rank) { if (rank < 1) throw new IndexOutOfRangeException(); return make_array_type(rank); } [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Type make_byref_type(); public override Type MakeByRefType() { if (IsByRef) throw new TypeLoadException("Can not call MakeByRefType on a ByRef type"); return make_byref_type(); } [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Type MakePointerType(Type type); public override Type MakePointerType() { if (IsByRef) throw new TypeLoadException($"Could not load type '{GetType()}' from assembly '{AssemblyQualifiedName}"); return MakePointerType(this); } public override StructLayoutAttribute? StructLayoutAttribute { get { return GetStructLayoutAttribute(); } } public override bool ContainsGenericParameters { get { if (IsGenericParameter) return true; if (IsGenericType) { foreach (Type arg in GetGenericArguments()) if (arg.ContainsGenericParameters) return true; } if (HasElementType) return GetElementType().ContainsGenericParameters; return false; } } public override Type[] GetGenericParameterConstraints() { if (!IsGenericParameter) throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter")); var paramInfo = new Mono.RuntimeGenericParamInfoHandle(RuntimeTypeHandle.GetGenericParameterInfo(this)); Type[] constraints = paramInfo.Constraints; return constraints ?? Type.EmptyTypes; } internal static object CreateInstanceForAnotherGenericParameter(Type genericType, RuntimeType genericArgument) { var gt = (RuntimeType)MakeGenericType(genericType, new Type[] { genericArgument }); RuntimeConstructorInfo ctor = gt.GetDefaultConstructor()!; return ctor.InternalInvoke(null, null, wrapExceptions: true)!; } [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern Type MakeGenericType(Type gt, Type[] types); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr GetMethodsByName_native(IntPtr namePtr, BindingFlags bindingAttr, MemberListType listType); internal RuntimeMethodInfo[] GetMethodsByName(string? name, BindingFlags bindingAttr, MemberListType listType, RuntimeType reflectedType) { var refh = new RuntimeTypeHandle(reflectedType); using (var namePtr = new Mono.SafeStringMarshal(name)) using (var h = new Mono.SafeGPtrArrayHandle(GetMethodsByName_native(namePtr.Value, bindingAttr, listType))) { int n = h.Length; var a = new RuntimeMethodInfo[n]; for (int i = 0; i < n; i++) { var mh = new RuntimeMethodHandle(h[i]); a[i] = (RuntimeMethodInfo)RuntimeMethodInfo.GetMethodFromHandleNoGenericCheck(mh, refh); } return a; } } [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern IntPtr GetPropertiesByName_native(IntPtr name, BindingFlags bindingAttr, MemberListType listType); [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern IntPtr GetConstructors_native(BindingFlags bindingAttr); private RuntimeConstructorInfo[] GetConstructors_internal(BindingFlags bindingAttr, RuntimeType reflectedType) { var refh = new RuntimeTypeHandle(reflectedType); using (var h = new Mono.SafeGPtrArrayHandle(GetConstructors_native(bindingAttr))) { int n = h.Length; var a = new RuntimeConstructorInfo[n]; for (int i = 0; i < n; i++) { var mh = new RuntimeMethodHandle(h[i]); a[i] = (RuntimeConstructorInfo)RuntimeMethodInfo.GetMethodFromHandleNoGenericCheck(mh, refh); } return a; } } private RuntimePropertyInfo[] GetPropertiesByName(string? name, BindingFlags bindingAttr, MemberListType listType, RuntimeType reflectedType) { var refh = new RuntimeTypeHandle(reflectedType); using (var namePtr = new Mono.SafeStringMarshal(name)) using (var h = new Mono.SafeGPtrArrayHandle(GetPropertiesByName_native(namePtr.Value, bindingAttr, listType))) { int n = h.Length; var a = new RuntimePropertyInfo[n]; for (int i = 0; i < n; i++) { var ph = new Mono.RuntimePropertyHandle(h[i]); a[i] = (RuntimePropertyInfo)RuntimePropertyInfo.GetPropertyFromHandle(ph, refh); } return a; } } public override InterfaceMapping GetInterfaceMap(Type ifaceType) { if (IsGenericParameter) throw new InvalidOperationException(Environment.GetResourceString("Arg_GenericParameter")); if (ifaceType is null) throw new ArgumentNullException(nameof(ifaceType)); RuntimeType? ifaceRtType = ifaceType as RuntimeType; if (ifaceRtType == null) throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(ifaceType)); InterfaceMapping res; if (!ifaceType.IsInterface) throw new ArgumentException("Argument must be an interface.", nameof(ifaceType)); if (IsInterface) throw new ArgumentException("'this' type cannot be an interface itself"); res.TargetType = this; res.InterfaceType = ifaceType; GetInterfaceMapData(this, ifaceType, out res.TargetMethods, out res.InterfaceMethods); if (res.TargetMethods == null) throw new ArgumentException("Interface not found", nameof(ifaceType)); return res; } [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void GetInterfaceMapData(Type t, Type iface, out MethodInfo[] targets, out MethodInfo[] methods); public override Guid GUID { get { object[] att = GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), true); if (att.Length == 0) return Guid.Empty; return new Guid(((System.Runtime.InteropServices.GuidAttribute)att[0]).Value); } } [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void GetPacking(out int packing, out int size); public override string ToString() { return getFullName(false, false); } [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern object CreateInstanceInternal(Type type); public extern override MethodBase? DeclaringMethod { [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern string getFullName(bool full_name, bool assembly_qualified); [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern Type[] GetGenericArgumentsInternal(bool runtimeArray); private GenericParameterAttributes GetGenericParameterAttributes() { return (new Mono.RuntimeGenericParamInfoHandle(RuntimeTypeHandle.GetGenericParameterInfo(this))).Attributes; } [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern int GetGenericParameterPosition(); [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern IntPtr GetEvents_native(IntPtr name, MemberListType listType); [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern IntPtr GetFields_native(IntPtr name, BindingFlags bindingAttr, MemberListType listType); private RuntimeFieldInfo[] GetFields_internal(string? name, BindingFlags bindingAttr, MemberListType listType, RuntimeType reflectedType) { var refh = new RuntimeTypeHandle(reflectedType); using (var namePtr = new Mono.SafeStringMarshal(name)) using (var h = new Mono.SafeGPtrArrayHandle(GetFields_native(namePtr.Value, bindingAttr, listType))) { int n = h.Length; var a = new RuntimeFieldInfo[n]; for (int i = 0; i < n; i++) { var fh = new RuntimeFieldHandle(h[i]); a[i] = (RuntimeFieldInfo)FieldInfo.GetFieldFromHandle(fh, refh); } return a; } } private RuntimeEventInfo[] GetEvents_internal(string? name, MemberListType listType, RuntimeType reflectedType) { var refh = new RuntimeTypeHandle(reflectedType); using (var namePtr = new Mono.SafeStringMarshal(name)) using (var h = new Mono.SafeGPtrArrayHandle(GetEvents_native(namePtr.Value, listType))) { int n = h.Length; var a = new RuntimeEventInfo[n]; for (int i = 0; i < n; i++) { var eh = new Mono.RuntimeEventHandle(h[i]); a[i] = (RuntimeEventInfo)RuntimeEventInfo.GetEventFromHandle(eh, refh); } return a; } } [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern override Type[] GetInterfaces(); [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern IntPtr GetNestedTypes_native(IntPtr name, BindingFlags bindingAttr, MemberListType listType); private RuntimeType[] GetNestedTypes_internal(string? displayName, BindingFlags bindingAttr, MemberListType listType) { string? internalName = null; if (displayName != null) internalName = displayName; using (var namePtr = new Mono.SafeStringMarshal(internalName)) using (var h = new Mono.SafeGPtrArrayHandle(GetNestedTypes_native(namePtr.Value, bindingAttr, listType))) { int n = h.Length; var a = new RuntimeType[n]; for (int i = 0; i < n; i++) { var th = new RuntimeTypeHandle(h[i]); a[i] = (RuntimeType)GetTypeFromHandle(th); } return a; } } public override string? AssemblyQualifiedName { get { return getFullName(true, true); } } public extern override Type? DeclaringType { [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } public extern override string Name { [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } public extern override string? Namespace { [MethodImplAttribute(MethodImplOptions.InternalCall)] get; } public override string? FullName { get { // See https://github.com/mono/mono/issues/18180 and // https://github.com/dotnet/runtime/blob/69e114c1abf91241a0eeecf1ecceab4711b8aa62/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs#L1505-L1509 if (ContainsGenericParameters && !GetRootElementType().IsGenericTypeDefinition) return null; string? fullName; TypeCache? cache = Cache; if ((fullName = cache.full_name) == null) fullName = cache.full_name = getFullName(true, false); return fullName; } } public sealed override bool HasSameMetadataDefinitionAs(MemberInfo other) => HasSameMetadataDefinitionAsCore<RuntimeType>(other); public override bool IsSZArray { get { return RuntimeTypeHandle.IsSzArray(this); } } internal override bool IsUserType { get { return false; } } public override bool IsSubclassOf(Type type) { if (type is null) throw new ArgumentNullException(nameof(type)); RuntimeType? rtType = type as RuntimeType; if (rtType == null) return false; return RuntimeTypeHandle.IsSubclassOf(this, rtType); } private const int DEFAULT_PACKING_SIZE = 8; internal StructLayoutAttribute? GetStructLayoutAttribute() { if (IsInterface || HasElementType || IsGenericParameter) return null; int pack = 0, size = 0; LayoutKind layoutKind = LayoutKind.Auto; switch (Attributes & TypeAttributes.LayoutMask) { case TypeAttributes.ExplicitLayout: layoutKind = LayoutKind.Explicit; break; case TypeAttributes.AutoLayout: layoutKind = LayoutKind.Auto; break; case TypeAttributes.SequentialLayout: layoutKind = LayoutKind.Sequential; break; default: break; } CharSet charSet = CharSet.None; switch (Attributes & TypeAttributes.StringFormatMask) { case TypeAttributes.AnsiClass: charSet = CharSet.Ansi; break; case TypeAttributes.AutoClass: charSet = CharSet.Auto; break; case TypeAttributes.UnicodeClass: charSet = CharSet.Unicode; break; default: break; } GetPacking(out pack, out size); // Metadata parameter checking should not have allowed 0 for packing size. // The runtime later converts a packing size of 0 to 8 so do the same here // because it's more useful from a user perspective. if (pack == 0) pack = DEFAULT_PACKING_SIZE; return new StructLayoutAttribute(layoutKind) { Pack = pack, Size = size, CharSet = charSet }; } } }
40.678447
189
0.541829
[ "MIT" ]
Escoto/runtime
src/mono/netcore/System.Private.CoreLib/src/System/RuntimeType.Mono.cs
104,747
C#
using Foundation; namespace ShellFlyoutSample; [Register("AppDelegate")] public class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); }
20.9
75
0.803828
[ "MIT" ]
xamarin/net5-samples
6.0/Navigation/ShellFlyoutSample/ShellFlyoutSample/Platforms/MacCatalyst/AppDelegate.cs
211
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using Azure; using Azure.Core; namespace Azure.Security.KeyVault.Administration { internal class ServiceFullBackupHeaders { private readonly Response _response; public ServiceFullBackupHeaders(Response response) { _response = response; } /// <summary> The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. </summary> public int? RetryAfter => _response.Headers.TryGetValue("Retry-After", out int? value) ? value : null; /// <summary> The URI to poll for completion status. </summary> public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null; } }
34.076923
132
0.699774
[ "MIT" ]
AbelHu/azure-sdk-for-net
sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/ServiceFullBackupHeaders.cs
886
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.Globalization; using System.Net; using AutoRest.Core.Model; namespace AutoRest.Swagger { /// <summary> /// Provides useful extension methods to simplify common coding tasks. /// </summary> public static class Extensions { public static HttpStatusCode ToHttpStatusCode(this string statusCode) { return (HttpStatusCode) Enum.Parse(typeof (HttpStatusCode), statusCode); } public static HttpMethod ToHttpMethod(this string verb) { if (verb == null) { throw new ArgumentNullException("verb"); } switch (verb.ToLower()) { case "get": return HttpMethod.Get; case "post": return HttpMethod.Post; case "put": return HttpMethod.Put; case "head": return HttpMethod.Head; case "delete": return HttpMethod.Delete; case "patch": return HttpMethod.Patch; case "options": return HttpMethod.Options; default: throw new NotImplementedException(); } } /// <summary> /// Removes #/definitions/ or url#/definitions from the reference path. /// </summary> /// <param name="reference">Definition reference.</param> /// <returns>Definition name with path.</returns> public static string StripDefinitionPath(this string reference) { if (reference != null && reference.Contains("#/definitions/")) { reference = reference.Substring(reference.IndexOf("#/definitions/", StringComparison.OrdinalIgnoreCase) + "#/definitions/".Length); } return reference; } /// <summary> /// Removes #/parameters/ or url#/parameters from the reference path. /// </summary> /// <param name="reference">Parameter reference.</param> /// <returns>Parameter name with path.</returns> public static string StripParameterPath(this string reference) { if (reference != null && reference.Contains("#/parameters/")) { reference = reference.Substring(reference.IndexOf("#/parameters/", StringComparison.OrdinalIgnoreCase) + "#/parameters/".Length); } return reference; } } }
34.135802
121
0.545027
[ "MIT" ]
bloudraak/autorest
src/modeler/AutoRest.Swagger/Extensions.cs
2,767
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 Grumpy.FeatureToggle.Entity { using System; using System.Collections.Generic; public partial class FeatureToggle { public int Id { get; set; } public string ServiceName { get; set; } public string UserName { get; set; } public string MachineName { get; set; } public string Feature { get; set; } public int Priority { get; set; } public bool Enabled { get; set; } } }
33.961538
85
0.525481
[ "MIT" ]
GrumpyBusted/Grumpy.FeatureToggle
Grumpy.FeatureToggle.Entity/FeatureToggle.cs
883
C#
using nst.coe.mediator.cli.enums; using nst.coe.mediator.cli.interfaces; namespace nst.coe.mediator.cli.models { public class Aircraft { protected IMediator _mediator; public IMediator Mediator { set { this._mediator = value; } } public Aircraft(IMediator? mediator = null) { this._mediator = mediator; } protected void DoAction(Aircraft caller, AircraftAction action) { Console.WriteLine($"{caller.GetType().Name} does {action}..."); this._mediator.Notify(this, action); } } }
18.137931
66
0.692015
[ "Unlicense" ]
carlosjasso/nst-coe-mediator
src/nst.coe.mediator.cli/models/Aircraft.cs
526
C#
using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Sockets; namespace Nowin { public class IpIsLocalChecker : IIpIsLocalChecker { readonly Dictionary<IPAddress, bool> _dict; public IpIsLocalChecker() { try { var host = Dns.GetHostEntry(Dns.GetHostName()); _dict = host.AddressList.Where( a => a.AddressFamily == AddressFamily.InterNetwork || a.AddressFamily == AddressFamily.InterNetworkV6) .Distinct() .ToDictionary(p => p, p => true); } catch (SocketException) { _dict = new Dictionary<IPAddress, bool>(); } _dict[IPAddress.Loopback] = true; _dict[IPAddress.IPv6Loopback] = true; } public bool IsLocal(IPAddress address) { if (_dict.ContainsKey(address)) return true; if (IPAddress.IsLoopback(address)) return true; if (address.IsIPv4MappedToIPv6) { var ip4 = address.MapToIPv4(); if (_dict.ContainsKey(ip4)) return true; } return false; } } }
26.313725
121
0.5
[ "MIT" ]
Bobris/Nowin
Nowin/IpIsLocalChecker.cs
1,342
C#
//------------------------------------------------------------------------------ // <自动生成> // 此代码由工具生成。 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // </自动生成> //------------------------------------------------------------------------------ namespace Mozart.CMSAdmin.Album { public partial class wfmUserPhotoAdmin { } }
22.375
81
0.321229
[ "Apache-2.0" ]
zhenghua75/WeiXinEasy
Mozart/CMSAdmin/Album/wfmUserPhotoAdmin.aspx.designer.cs
472
C#
/*---------------------------------------------------------------- Copyright (C) 2016 Senparc 文件名:ResponseMessageBase.cs 文件功能描述:响应回复消息基类 创建标识:Senparc - 20150211 修改标识:Senparc - 20150303 修改描述:整理接口 修改标识:Senparc - 20150505 修改描述:添加ResponseMessageNoResponse类型处理 ----------------------------------------------------------------*/ using System; using System.Xml.Linq; using Niue.WeChat.Core.Exceptions; using Niue.WeChat.PublicAccounts.Entities.Request; using Niue.WeChat.PublicAccounts.Helpers; namespace Niue.WeChat.PublicAccounts.Entities.Response { public interface IResponseMessageBase : Core.Entities.Response.IResponseMessageBase { ResponseMsgType MsgType { get; } //string Content { get; set; } //bool FuncFlag { get; set; } } /// <summary> /// 微信公众号响应回复消息 /// </summary> public class ResponseMessageBase : Core.Entities.Response.ResponseMessageBase, IResponseMessageBase { public virtual ResponseMsgType MsgType { get { return ResponseMsgType.Text; } } //public string Content { get; set; } //public bool FuncFlag { get; set; } /// <summary> /// 获取响应类型实例,并初始化 /// </summary> /// <param name="requestMessage">请求</param> /// <param name="msgType">响应类型</param> /// <returns></returns> [Obsolete("建议使用CreateFromRequestMessage<T>(IRequestMessageBase requestMessage)取代此方法")] private static ResponseMessageBase CreateFromRequestMessage(IRequestMessageBase requestMessage, ResponseMsgType msgType) { ResponseMessageBase responseMessage = null; try { switch (msgType) { case ResponseMsgType.Text: responseMessage = new ResponseMessageText(); break; case ResponseMsgType.News: responseMessage = new ResponseMessageNews(); break; case ResponseMsgType.Music: responseMessage = new ResponseMessageMusic(); break; case ResponseMsgType.Image: responseMessage = new ResponseMessageImage(); break; case ResponseMsgType.Voice: responseMessage = new ResponseMessageVoice(); break; case ResponseMsgType.Video: responseMessage = new ResponseMessageVideo(); break; case ResponseMsgType.Transfer_Customer_Service: responseMessage = new ResponseMessageTransfer_Customer_Service(); break; case ResponseMsgType.NoResponse: responseMessage = new ResponseMessageNoResponse(); break; default: throw new UnknownRequestMsgTypeException(string.Format("ResponseMsgType没有为 {0} 提供对应处理程序。", msgType), new ArgumentOutOfRangeException()); } responseMessage.ToUserName = requestMessage.FromUserName; responseMessage.FromUserName = requestMessage.ToUserName; responseMessage.CreateTime = DateTime.Now; //使用当前最新时间 } catch (Exception ex) { throw new WeixinException("CreateFromRequestMessage过程发生异常", ex); } return responseMessage; } /// <summary> /// 获取响应类型实例,并初始化 /// </summary> /// <typeparam name="T">需要返回的类型</typeparam> /// <param name="requestMessage">请求数据</param> /// <returns></returns> public static T CreateFromRequestMessage<T>(IRequestMessageBase requestMessage) where T : ResponseMessageBase { try { var tType = typeof(T); var responseName = tType.Name.Replace("ResponseMessage", ""); //请求名称 ResponseMsgType msgType = (ResponseMsgType)Enum.Parse(typeof(ResponseMsgType), responseName); return CreateFromRequestMessage(requestMessage, msgType) as T; } catch (Exception ex) { throw new WeixinException("ResponseMessageBase.CreateFromRequestMessage<T>过程发生异常!", ex); } } /// <summary> /// 从返回结果XML转换成IResponseMessageBase实体类 /// </summary> /// <param name="xml">返回给服务器的Response Xml</param> /// <returns></returns> public static IResponseMessageBase CreateFromResponseXml(string xml) { try { if (string.IsNullOrEmpty(xml)) { return null; } var doc = XDocument.Parse(xml); ResponseMessageBase responseMessage = null; var msgType = (ResponseMsgType)Enum.Parse(typeof(ResponseMsgType), doc.Root.Element("MsgType").Value, true); switch (msgType) { case ResponseMsgType.Text: responseMessage = new ResponseMessageText(); break; case ResponseMsgType.Image: responseMessage = new ResponseMessageImage(); break; case ResponseMsgType.Voice: responseMessage = new ResponseMessageVoice(); break; case ResponseMsgType.Video: responseMessage = new ResponseMessageVideo(); break; case ResponseMsgType.Music: responseMessage = new ResponseMessageMusic(); break; case ResponseMsgType.News: responseMessage = new ResponseMessageNews(); break; case ResponseMsgType.Transfer_Customer_Service: responseMessage = new ResponseMessageTransfer_Customer_Service(); break; } responseMessage.FillEntityWithXml(doc); return responseMessage; } catch (Exception ex) { throw new WeixinException("ResponseMessageBase.CreateFromResponseXml<T>过程发生异常!" + ex.Message, ex); } } } }
30.337209
142
0.668455
[ "MIT" ]
P79N6A/abp-ant-design-pro-vue
Niue.WeChat/PublicAccounts/Entities/Response/ResponseMessageBase.cs
5,578
C#
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; namespace Microsoft.CodeAnalysis.FxCopAnalyzers { public abstract class CodeFixProviderBase : CodeFixProvider { protected abstract string GetCodeFixDescription(Diagnostic diagnostic); internal abstract Task<Document> GetUpdatedDocumentAsync(Document document, SemanticModel model, SyntaxNode root, SyntaxNode nodeToFix, Diagnostic diagnostic, CancellationToken cancellationToken); public sealed override async Task ComputeFixesAsync(CodeFixContext context) { var document = context.Document; var cancellationToken = context.CancellationToken; var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); foreach (var diagnostic in context.Diagnostics) { cancellationToken.ThrowIfCancellationRequested(); var nodeToFix = root.FindNode(diagnostic.Location.SourceSpan); var newDocument = await GetUpdatedDocumentAsync(document, model, root, nodeToFix, diagnostic, cancellationToken).ConfigureAwait(false); Debug.Assert(newDocument != null); if (newDocument != document) { var codeFixDescription = GetCodeFixDescription(diagnostic); context.RegisterFix(new MyCodeAction(codeFixDescription, newDocument), diagnostic); } } } public override FixAllProvider GetFixAllProvider() { return null; } private class MyCodeAction : CodeAction.DocumentChangeAction { public MyCodeAction(string title, Document newDocument) : base(title, c => Task.FromResult(newDocument)) { } } } }
40.709091
204
0.677981
[ "Apache-2.0" ]
enginekit/copy_of_roslyn
Src/Diagnostics/FxCop/Core/CodeFixProviderBase.cs
2,241
C#
using System; using System.Collections.Generic; using System.Text; namespace Kyameru.Component.Ftp.Settings { /// <summary> /// Configuration extensions. /// </summary> public static class ConfigSetup { /// <summary> /// Valid from headers /// </summary> private static string[] fromHeaders = new string[] { "Target", "Host", "UserName", "Password", "Recursive", "PollTime", "Delete", "Port", "Filter" }; private static string[] toHeaders = new string[] { "Target", "Host", "UserName", "Password", "Archive", "Source" }; /// <summary> /// Converts incoming headers to valid processing headers. /// </summary> /// <param name="incoming">Incoming dictionary.</param> /// <returns>Returns a dictionary of valid headers.</returns> public static Dictionary<string, string> ToFromConfig(this Dictionary<string, string> incoming) { Dictionary<string, string> response = new Dictionary<string, string>(); for (int i = 0; i < fromHeaders.Length; i++) { if (incoming.ContainsKey(fromHeaders[i])) { response.Add(fromHeaders[i], incoming[fromHeaders[i]]); } } CheckDefaultHeaders(response); return response; } /// <summary> /// Converts incoming headers to valid processing headers. /// </summary> /// <param name="incoming">Incoming dictionary.</param> /// <returns>Returns a dictionary of valid headers.</returns> public static Dictionary<string, string> ToToConfig(this Dictionary<string, string> incoming) { Dictionary<string, string> response = new Dictionary<string, string>(); for (int i = 0; i < toHeaders.Length; i++) { if (incoming.ContainsKey(toHeaders[i])) { response.Add(toHeaders[i], incoming[toHeaders[i]]); } } CheckDefaultHeaders(response); return response; } /// <summary> /// Ensures required headers are populated. /// </summary> /// <param name="response"></param> private static void CheckDefaultHeaders(Dictionary<string, string> response) { response.SetDefault("PollTime", "60000"); response.SetDefault("Filter", "*.*"); response.SetDefault("Delete", "false"); response.SetDefault("Recursive", "false"); response.SetDefault("Port", "21"); } /// <summary> /// Gets a key value from a dictionary. /// </summary> /// <param name="incoming">Incoming dictionary.</param> /// <param name="key">Key to find.</param> /// <returns>Returns an empty string if key not found.</returns> public static string GetKeyValue(this Dictionary<string, string> incoming, string key) { string response = string.Empty; if (incoming.ContainsKey(key)) { response = incoming[key]; } return response; } /// <summary> /// Sets a default value if it doesn't exist. /// </summary> /// <param name="incoming">Incoming dictionary.</param> /// <param name="key">Target key.</param> /// <param name="value">Required value.</param> public static void SetDefault(this Dictionary<string, string> incoming, string key, string value) { if (!incoming.ContainsKey(key)) { incoming.Add(key, value); } } } }
35.695238
157
0.548026
[ "MIT" ]
djsuperchief/Kyameru
source/components/Kyameru.Component.Ftp/Implementation/Settings/ConfigSetup.cs
3,750
C#
namespace CityLight.Forms { partial class MainForm { /// <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.btnCustomers = new System.Windows.Forms.Button(); this.SuspendLayout(); // // btnCustomers // this.btnCustomers.Location = new System.Drawing.Point(27, 202); this.btnCustomers.Name = "btnCustomers"; this.btnCustomers.Size = new System.Drawing.Size(227, 52); this.btnCustomers.TabIndex = 0; this.btnCustomers.Text = "Клієнти"; this.btnCustomers.UseVisualStyleBackColor = true; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1234, 796); this.Controls.Add(this.btnCustomers); this.Name = "MainForm"; this.Text = " "; this.ResumeLayout(false); } #endregion private System.Windows.Forms.Button btnCustomers; } }
32.766667
107
0.553917
[ "CC0-1.0", "MIT" ]
andriy-mazur/city-light
net-app/CityLight/CityLight.Forms/MainForm.Designer.cs
1,975
C#
// Copyright (c) Mihir Dilip. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for license information. namespace AspNetCore.Authentication.ApiKey { /// <summary> /// Default values used by api key authentication. /// </summary> public static class ApiKeyDefaults { /// <summary> /// Default value for AuthenticationScheme /// </summary> public const string AuthenticationScheme = "ApiKey"; } }
26.823529
96
0.721491
[ "MIT" ]
andy-clymer/aspnetcore-authentication-apikey
src/AspNetCore.Authentication.ApiKey/ApiKeyDefaults.cs
458
C#
using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; using Microsoft.Extensions.Logging; namespace GraphQL.Server.Transports.Subscriptions.Abstractions { /// <summary> /// Subscription server /// Acts as a message pump reading, handling and writing messages /// </summary> public class SubscriptionServer : IServerOperations { private readonly ILogger<SubscriptionServer> _logger; private readonly IEnumerable<IOperationMessageListener> _messageListeners; private ActionBlock<OperationMessage> _handler; public SubscriptionServer( IMessageTransport transport, ISubscriptionManager subscriptions, IEnumerable<IOperationMessageListener> messageListeners, ILogger<SubscriptionServer> logger) { _messageListeners = messageListeners; _logger = logger; Subscriptions = subscriptions; Transport = transport; } public IMessageTransport Transport { get; } public ISubscriptionManager Subscriptions { get; } public IReaderPipeline TransportReader { get; set; } public IWriterPipeline TransportWriter { get; set; } public async Task OnConnect() { _logger.LogInformation("Connected..."); LinkToTransportWriter(); LinkToTransportReader(); LogServerInformation(); // when transport reader is completed it should propagate here await _handler.Completion; // complete write buffer await TransportWriter.Complete(); await TransportWriter.Completion; } public Task OnDisconnect() { return Terminate(); } public async Task Terminate() { foreach (var subscription in Subscriptions) await Subscriptions.UnsubscribeAsync(subscription.Id); // this should propagate to handler completion await TransportReader.Complete(); } private void LogServerInformation() { // list listeners var builder = new StringBuilder(); builder.AppendLine("Message listeners:"); foreach (var listener in _messageListeners) builder.AppendLine(listener.GetType().FullName); _logger.LogInformation(builder.ToString()); } private void LinkToTransportReader() { _logger.LogDebug("Creating reader pipeline"); TransportReader = Transport.Reader; _handler = new ActionBlock<OperationMessage>(HandleMessageAsync, new ExecutionDataflowBlockOptions { EnsureOrdered = true, BoundedCapacity = 1 }); TransportReader.LinkTo(_handler); _logger.LogDebug("Reader pipeline created"); } private async Task HandleMessageAsync(OperationMessage message) { _logger.LogDebug("Handling message: {id} of type: {type}", message.Id, message.Type); using (var context = await BuildMessageHandlingContext(message)) { await OnBeforeHandleAsync(context); if (context.Terminated) return; await OnHandleAsync(context); await OnAfterHandleAsync(context); } } private async Task OnBeforeHandleAsync(MessageHandlingContext context) { foreach (var listener in _messageListeners) { await listener.BeforeHandleAsync(context); } } private Task<MessageHandlingContext> BuildMessageHandlingContext(OperationMessage message) { return Task.FromResult(new MessageHandlingContext(this, message)); } private async Task OnHandleAsync(MessageHandlingContext context) { foreach (var listener in _messageListeners) { await listener.HandleAsync(context); } } private async Task OnAfterHandleAsync(MessageHandlingContext context) { foreach (var listener in _messageListeners) { await listener.AfterHandleAsync(context); } } private void LinkToTransportWriter() { _logger.LogDebug("Creating writer pipeline"); TransportWriter = Transport.Writer; _logger.LogDebug("Writer pipeline created"); } } }
32.172414
110
0.60686
[ "MIT" ]
OneCyrus/server
src/Transports.Subscriptions.Abstractions/SubscriptionServer.cs
4,667
C#
using System.IO; using Machine.Specifications; namespace Test.FAKECore.FileHandling { public class when_cleaning_directory_after_creating_test_structure : BaseFunctions { Establish context = CreateTestFileStructure; Because of = () => CleanDir(TestData.TestDir); It should_be_writeable = () => new DirectoryInfo(TestData.TestDir).Attributes.ShouldEqual(FileAttributes.Directory); It should_cleaned_all_dirs = () => AllDirectories().ShouldBeEmpty(); It should_cleaned_all_files = () => AllFiles().ShouldBeEmpty(); It should_still_exist = () => new DirectoryInfo(TestData.TestDir).Exists.ShouldBeTrue(); } }
35.894737
103
0.709677
[ "Apache-2.0" ]
Andrea/FAKE
src/test/Test.FAKECore/FileHandling/CleanDirectorySpecs.cs
684
C#
using NLog; using NLog.Targets; class Example { static void Main(string[] args) { NLogViewerTarget target = new NLogViewerTarget(); target.Address = "udp://localhost:4000"; NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug); Logger logger = LogManager.GetLogger("Example"); logger.Trace("log message 1"); logger.Debug("log message 2"); logger.Info("log message 3"); logger.Warn("log message 4"); logger.Error("log message 5"); logger.Fatal("log message 6"); } }
26.681818
89
0.632027
[ "BSD-3-Clause" ]
0xC057A/NLog
examples/targets/Configuration API/NLogViewer/Simple/Example.cs
587
C#
using System.Configuration; using System.Data.Common; using System.Threading; using Dasync.Collections; using Rhino.Etl.Core.Infrastructure; namespace Rhino.Etl.Core.Operations { using System.Collections.Generic; using System.Data; /// <summary> /// Generic input command operation /// </summary> public abstract class InputCommandOperation : AbstractCommandOperation { /// <summary> /// Initializes a new instance of the <see cref="OutputCommandOperation"/> class. /// </summary> /// <param name="connectionStringName">Name of the connection string.</param> public InputCommandOperation(string connectionStringName) : this(ConfigurationManager.ConnectionStrings[connectionStringName]) { } /// <summary> /// Initializes a new instance of the <see cref="OutputCommandOperation"/> class. /// </summary> /// <param name="connectionStringSettings">Connection string settings to use.</param> public InputCommandOperation(ConnectionStringSettings connectionStringSettings) : base(connectionStringSettings) { UseTransaction = true; } /// <summary> /// Executes this operation /// </summary> /// <param name="rows">The rows.</param> /// <param name="cancellationToken">A CancellationToken to stop execution</param> /// <returns></returns> public override IAsyncEnumerable<Row> Execute(IAsyncEnumerable<Row> rows, CancellationToken cancellationToken = default) { return new AsyncEnumerable<Row>(async yield => { using (DbConnection connection = await Database.Connection(ConnectionStringSettings, cancellationToken)) using (DbTransaction transaction = BeginTransaction(connection)) { using (currentCommand = connection.CreateCommand()) { currentCommand.Transaction = transaction; PrepareCommand(currentCommand); using (DbDataReader reader = await currentCommand.ExecuteReaderAsync(cancellationToken)) { while (await reader.ReadAsync(cancellationToken)) { await yield.ReturnAsync(CreateRowFromReader(reader)); } } } if (transaction != null) transaction.Commit(); } }); } /// <summary> /// Creates a row from the reader. /// </summary> /// <param name="reader">The reader.</param> /// <returns></returns> protected abstract Row CreateRowFromReader(IDataReader reader); /// <summary> /// Prepares the command for execution, set command text, parameters, etc /// </summary> /// <param name="cmd">The command.</param> protected abstract void PrepareCommand(IDbCommand cmd); } }
38.9375
128
0.585875
[ "BSD-3-Clause" ]
eisbaer66/rhino-etl
Rhino.Etl.Core/Operations/InputCommandOperation.cs
3,115
C#
namespace TimeWarp.Architecture; /// <summary> /// A class used to reference the assembly /// </summary> /// <remarks> /// When you want to scan items in assembly you have pass in a class in the assembly. /// Refactoring by moving things around can sometimes cause issues. /// If you want a specific Assembly you can reference this class. /// </remarks> public class Api_Domain_Assembly { }
30.307692
85
0.728426
[ "Unlicense" ]
TimeWarpEngineering/timewarp-architecture
Source/TimeWarp.Architecture.Template/templates/TimeWarp.Architecture/Source/ContainerApps/Api/Api.Domain/AssemlyAnnotations.cs
396
C#
using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEditorInternal; namespace UnityEditor.Search { [CustomEditor(typeof(SearchQuery), editorForChildClasses: false, isFallback = false)] class SearchQueryEditor : Editor { private SearchResultView m_ResultView; private SortedSearchList m_Results; private SearchContext m_SearchContext; private SerializedProperty m_IconProperty; private SerializedProperty m_DescriptionProperty; private SerializedProperty m_TextProperty; private SerializedProperty m_ProvidersProperty; private ReorderableList m_ProvidersList; public void OnEnable() { m_IconProperty = serializedObject.FindProperty(nameof(SearchQuery.icon)); m_DescriptionProperty = serializedObject.FindProperty(nameof(SearchQuery.description)); m_TextProperty = serializedObject.FindProperty(nameof(SearchQuery.text)); m_ProvidersProperty = serializedObject.FindProperty(nameof(SearchQuery.providerIds)); m_ProvidersList = new ReorderableList(serializedObject, m_ProvidersProperty, false, true, true, true) { onAddCallback = AddProvider, onCanAddCallback = list => m_ProvidersProperty.arraySize < SearchService.Providers.Count(p => p.active), onRemoveCallback = RemoveProvider, onCanRemoveCallback = list => m_ProvidersProperty.arraySize > 1, drawElementCallback = DrawProviderElement, elementHeight = EditorGUIUtility.singleLineHeight, drawHeaderCallback = DrawProvidersHeader }; SetupContext(GetEnabledProviders()); } public void OnDisable() { m_SearchContext.asyncItemReceived -= OnAsyncItemsReceived; m_SearchContext.Dispose(); m_Results.Dispose(); } private static bool ContainsString(SerializedProperty arrayProperty, string value) { for (var i = 0; i < arrayProperty.arraySize; i++) { if (arrayProperty.GetArrayElementAtIndex(i).stringValue == value) return true; } return false; } private IEnumerable<SearchProvider> GetEnabledProviders() { return SearchService.OrderedProviders.Where(p => ContainsString(m_ProvidersProperty, p.id)); } private IEnumerable<SearchProvider> GetDisabledProviders() { return SearchService.OrderedProviders.Where(p => !ContainsString(m_ProvidersProperty, p.id)); } private void SetupContext(IEnumerable<SearchProvider> providers) { m_Results?.Dispose(); m_ResultView?.Dispose(); if (m_SearchContext != null) { m_SearchContext.Dispose(); m_SearchContext.asyncItemReceived -= OnAsyncItemsReceived; } m_SearchContext = SearchService.CreateContext(providers, m_TextProperty.stringValue, SearchSettings.GetContextOptions()); m_SearchContext.asyncItemReceived += OnAsyncItemsReceived; m_Results = new SortedSearchList(m_SearchContext); m_ResultView = new SearchResultView(m_Results); RefreshResults(); } private void SetItems(IEnumerable<SearchItem> items) { m_Results.Clear(); m_Results.AddItems(items); Repaint(); } private void OnAsyncItemsReceived(SearchContext context, IEnumerable<SearchItem> items) { m_Results.AddItems(items); Repaint(); } private void RefreshResults() { SetItems(SearchService.GetItems(m_SearchContext)); } public override bool HasPreviewGUI() { return true; } public override bool RequiresConstantRepaint() { return false; } public override bool UseDefaultMargins() { return false; } // Implement to create your own interactive custom preview. Interactive custom previews are used in the preview area of the inspector and the object selector. public override void OnInteractivePreviewGUI(Rect r, GUIStyle background) { m_ResultView.OnGUI(r); } public override void OnInspectorGUI() { serializedObject.UpdateIfRequiredOrScript(); CheckContext(); EditorGUILayout.BeginHorizontal(); { #if USE_SEARCH_MODULE Vector2 dropDownSize = EditorGUI.GetObjectIconDropDownSize(32, 32); var iconRect = GUILayoutUtility.GetRect(dropDownSize.x, dropDownSize.y, GUILayout.ExpandWidth(false)); ObjectIconDropDown(iconRect, m_IconProperty); #endif EditorGUILayout.BeginVertical(); { var originalText = m_TextProperty.stringValue; EditorGUILayout.DelayedTextField(m_TextProperty, new GUIContent("Search Text")); if (originalText != m_TextProperty.stringValue) { m_SearchContext.searchText = m_TextProperty.stringValue; RefreshResults(); } EditorGUILayout.PropertyField(m_DescriptionProperty); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); m_ProvidersList.DoLayoutList(); if (serializedObject.hasModifiedProperties) serializedObject.ApplyModifiedProperties(); } #if USE_SEARCH_MODULE private static GUIStyle s_IconButtonStyle; private static Material s_IconTextureInactive; private static GUIContent s_IconDropDown; public void ObjectIconDropDown(Rect position, SerializedProperty iconProperty) { const float kDropDownArrowMargin = 2; const float kDropDownArrowWidth = 12; const float kDropDownArrowHeight = 12; if (s_IconTextureInactive == null) s_IconTextureInactive = (Material)EditorGUIUtility.LoadRequired("Inspectors/InactiveGUI.mat"); if (s_IconButtonStyle == null) s_IconButtonStyle = new GUIStyle("IconButton") { fixedWidth = 0, fixedHeight = 0 }; void SelectIcon(UnityEngine.Object obj) { iconProperty.objectReferenceValue = obj; iconProperty.serializedObject.ApplyModifiedProperties(); SearchService.RefreshWindows(); } if (EditorGUI.DropdownButton(position, GUIContent.none, FocusType.Passive, s_IconButtonStyle)) { ObjectSelector.get.Show(typeof(Texture2D), iconProperty, false, null, SelectIcon, SelectIcon); GUIUtility.ExitGUI(); } if (Event.current.type == EventType.Repaint) { var contentPosition = position; contentPosition.xMin += kDropDownArrowMargin; contentPosition.xMax -= kDropDownArrowMargin + kDropDownArrowWidth / 2; contentPosition.yMin += kDropDownArrowMargin; contentPosition.yMax -= kDropDownArrowMargin + kDropDownArrowWidth / 2; Rect arrowRect = new Rect( contentPosition.x + contentPosition.width - kDropDownArrowWidth / 2, contentPosition.y + contentPosition.height - kDropDownArrowHeight / 2, kDropDownArrowWidth, kDropDownArrowHeight); Texture2D icon = null; if (!iconProperty.hasMultipleDifferentValues) icon = iconProperty.objectReferenceValue as Texture2D ?? AssetPreview.GetMiniThumbnail(targets[0]); if (icon == null) icon = Icons.favorite; Vector2 iconSize = contentPosition.size; if (icon) { iconSize.x = Mathf.Min(icon.width, iconSize.x); iconSize.y = Mathf.Min(icon.height, iconSize.y); } Rect iconRect = new Rect( contentPosition.x + contentPosition.width / 2 - iconSize.x / 2, contentPosition.y + contentPosition.height / 2 - iconSize.y / 2, iconSize.x, iconSize.y); GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); if (s_IconDropDown == null) s_IconDropDown = EditorGUIUtility.IconContent("Icon Dropdown"); GUIStyle.none.Draw(arrowRect, s_IconDropDown, false, false, false, false); } } #endif private static void DrawProvidersHeader(Rect headerRect) { GUI.Label(headerRect, "Providers"); } void AddProvider(ReorderableList list) { var menu = new GenericMenu(); var disabledProviders = GetDisabledProviders().ToList(); for (var i = 0; i < disabledProviders.Count; ++i) { var provider = disabledProviders[i]; menu.AddItem(new GUIContent(provider.name), false, AddProvider, provider); if (!provider.isExplicitProvider && i + 1 < disabledProviders.Count && disabledProviders[i + 1].isExplicitProvider) { menu.AddSeparator(string.Empty); } } menu.ShowAsContext(); } void AddProvider(object providerObj) { var provider = providerObj as SearchProvider; var enabledProviders = GetEnabledProviders().ToList(); enabledProviders.Add(provider); UpdateEnabledProviders(enabledProviders); } void RemoveProvider(ReorderableList list) { var index = list.index; if (index != -1) { var toRemove = SearchService.GetProvider(m_ProvidersProperty.GetArrayElementAtIndex(index).stringValue); if (toRemove == null) return; var enabledProviders = GetEnabledProviders().ToList(); enabledProviders.Remove(toRemove); UpdateEnabledProviders(enabledProviders); if (index >= list.count) list.index = list.count - 1; } } void UpdateEnabledProviders(List<SearchProvider> enabledProviders) { m_ProvidersProperty.arraySize = enabledProviders.Count; for (var i = 0; i < enabledProviders.Count; ++i) { m_ProvidersProperty.GetArrayElementAtIndex(i).stringValue = enabledProviders[i].id; } serializedObject.ApplyModifiedProperties(); SetupContext(enabledProviders); } void DrawProviderElement(Rect rect, int index, bool selected, bool focused) { if (index >= 0 && index < m_ProvidersProperty.arraySize) GUI.Label(rect, SearchService.GetProvider(m_ProvidersProperty.GetArrayElementAtIndex(index).stringValue)?.name ?? "<unknown>"); } void CheckContext() { if (m_SearchContext.searchText != m_TextProperty.stringValue) SetupContext(GetEnabledProviders()); } } }
38.82
166
0.597287
[ "MIT" ]
smuth98/Kyles-Fantastic-Dialogue-System
Kyles-Fantastic-Dialogue-System/Library/PackageCache/com.unity.quicksearch@3.0.0-preview.8/Editor/UI/SearchQueryEditor.cs
11,646
C#
using System.Collections.Generic; namespace E_Commerce_Shop.Entity { public class Card { public int Id { get; set; } public string UserId { get; set; } public List<CardItem> CardItems { get; set; } } }
19.916667
53
0.619247
[ "MIT" ]
MrSurgeon/E-Commerce-Shop
E-Commerce-Shop.Entity/Card.cs
239
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 wafv2-2019-07-29.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.WAFV2.Model; using Amazon.WAFV2.Model.Internal.MarshallTransformations; using Amazon.WAFV2.Internal; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Auth; using Amazon.Runtime.Internal.Transform; namespace Amazon.WAFV2 { /// <summary> /// Implementation for accessing WAFV2 /// /// <note> /// <para> /// This is the latest version of the <b>AWS WAF</b> API, released in November, 2019. /// The names of the entities that you use to access this API, like endpoints and namespaces, /// all have the versioning information added, like "V2" or "v2", to distinguish from /// the prior version. We recommend migrating your resources to this version, because /// it has a number of significant improvements. /// </para> /// /// <para> /// If you used AWS WAF prior to this release, you can't use this AWS WAFV2 API to access /// any AWS WAF resources that you created before. You can access your old rules, web /// ACLs, and other AWS WAF resources only through the AWS WAF Classic APIs. The AWS WAF /// Classic APIs have retained the prior names, endpoints, and namespaces. /// </para> /// /// <para> /// For information, including how to migrate your AWS WAF resources to this version, /// see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS requests /// that are forwarded to Amazon CloudFront, an Amazon API Gateway API, or an Application /// Load Balancer. AWS WAF also lets you control access to your content. Based on conditions /// that you specify, such as the IP addresses that requests originate from or the values /// of query strings, API Gateway, CloudFront, or the Application Load Balancer responds /// to requests either with the requested content or with an HTTP 403 status code (Forbidden). /// You also can configure CloudFront to return a custom error page when a request is /// blocked. /// </para> /// /// <para> /// This API guide is for developers who need detailed information about AWS WAF API actions, /// data types, and errors. For detailed information about AWS WAF features and an overview /// of how to use AWS WAF, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS /// WAF Developer Guide</a>. /// </para> /// /// <para> /// You can make calls using the endpoints listed in <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#waf_region">AWS /// Service Endpoints for AWS WAF</a>. /// </para> /// <ul> <li> /// <para> /// For regional applications, you can use any of the endpoints in the list. A regional /// application can be an Application Load Balancer (ALB) or an API Gateway stage. /// </para> /// </li> <li> /// <para> /// For AWS CloudFront applications, you must use the API endpoint listed for US East /// (N. Virginia): us-east-1. /// </para> /// </li> </ul> /// <para> /// Alternatively, you can use one of the AWS SDKs to access an API that's tailored to /// the programming language or platform that you're using. For more information, see /// <a href="http://aws.amazon.com/tools/#SDKs">AWS SDKs</a>. /// </para> /// /// <para> /// We currently provide two versions of the AWS WAF API: this API and the prior versions, /// the classic AWS WAF APIs. This new API provides the same functionality as the older /// versions, with the following major improvements: /// </para> /// <ul> <li> /// <para> /// You use one API for both global and regional applications. Where you need to distinguish /// the scope, you specify a <code>Scope</code> parameter and set it to <code>CLOUDFRONT</code> /// or <code>REGIONAL</code>. /// </para> /// </li> <li> /// <para> /// You can define a Web ACL or rule group with a single call, and update it with a single /// call. You define all rule specifications in JSON format, and pass them to your rule /// group or Web ACL calls. /// </para> /// </li> <li> /// <para> /// The limits AWS WAF places on the use of rules more closely reflects the cost of running /// each type of rule. Rule groups include capacity settings, so you know the maximum /// cost of a rule group when you use it. /// </para> /// </li> </ul> /// </summary> public partial class AmazonWAFV2Client : AmazonServiceClient, IAmazonWAFV2 { private static IServiceMetadata serviceMetadata = new AmazonWAFV2Metadata(); #region Constructors /// <summary> /// Constructs AmazonWAFV2Client 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> /// &lt;?xml version="1.0" encoding="utf-8" ?&gt; /// &lt;configuration&gt; /// &lt;appSettings&gt; /// &lt;add key="AWSProfileName" value="AWS Default"/&gt; /// &lt;/appSettings&gt; /// &lt;/configuration&gt; /// </code> /// /// </summary> public AmazonWAFV2Client() : base(FallbackCredentialsFactory.GetCredentials(), new AmazonWAFV2Config()) { } /// <summary> /// Constructs AmazonWAFV2Client 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> /// &lt;?xml version="1.0" encoding="utf-8" ?&gt; /// &lt;configuration&gt; /// &lt;appSettings&gt; /// &lt;add key="AWSProfileName" value="AWS Default"/&gt; /// &lt;/appSettings&gt; /// &lt;/configuration&gt; /// </code> /// /// </summary> /// <param name="region">The region to connect.</param> public AmazonWAFV2Client(RegionEndpoint region) : base(FallbackCredentialsFactory.GetCredentials(), new AmazonWAFV2Config{RegionEndpoint = region}) { } /// <summary> /// Constructs AmazonWAFV2Client 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> /// &lt;?xml version="1.0" encoding="utf-8" ?&gt; /// &lt;configuration&gt; /// &lt;appSettings&gt; /// &lt;add key="AWSProfileName" value="AWS Default"/&gt; /// &lt;/appSettings&gt; /// &lt;/configuration&gt; /// </code> /// /// </summary> /// <param name="config">The AmazonWAFV2Client Configuration Object</param> public AmazonWAFV2Client(AmazonWAFV2Config config) : base(FallbackCredentialsFactory.GetCredentials(), config) { } /// <summary> /// Constructs AmazonWAFV2Client with AWS Credentials /// </summary> /// <param name="credentials">AWS Credentials</param> public AmazonWAFV2Client(AWSCredentials credentials) : this(credentials, new AmazonWAFV2Config()) { } /// <summary> /// Constructs AmazonWAFV2Client with AWS Credentials /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="region">The region to connect.</param> public AmazonWAFV2Client(AWSCredentials credentials, RegionEndpoint region) : this(credentials, new AmazonWAFV2Config{RegionEndpoint = region}) { } /// <summary> /// Constructs AmazonWAFV2Client with AWS Credentials and an /// AmazonWAFV2Client Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonWAFV2Client Configuration Object</param> public AmazonWAFV2Client(AWSCredentials credentials, AmazonWAFV2Config clientConfig) : base(credentials, clientConfig) { } /// <summary> /// Constructs AmazonWAFV2Client 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 AmazonWAFV2Client(string awsAccessKeyId, string awsSecretAccessKey) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonWAFV2Config()) { } /// <summary> /// Constructs AmazonWAFV2Client 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 AmazonWAFV2Client(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonWAFV2Config() {RegionEndpoint=region}) { } /// <summary> /// Constructs AmazonWAFV2Client with AWS Access Key ID, AWS Secret Key and an /// AmazonWAFV2Client Configuration object. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="clientConfig">The AmazonWAFV2Client Configuration Object</param> public AmazonWAFV2Client(string awsAccessKeyId, string awsSecretAccessKey, AmazonWAFV2Config clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, clientConfig) { } /// <summary> /// Constructs AmazonWAFV2Client 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 AmazonWAFV2Client(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonWAFV2Config()) { } /// <summary> /// Constructs AmazonWAFV2Client 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 AmazonWAFV2Client(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonWAFV2Config{RegionEndpoint = region}) { } /// <summary> /// Constructs AmazonWAFV2Client with AWS Access Key ID, AWS Secret Key and an /// AmazonWAFV2Client 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 AmazonWAFV2Client Configuration Object</param> public AmazonWAFV2Client(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonWAFV2Config 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 AssociateWebACL /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Associates a Web ACL with a regional application resource, to protect the resource. /// A regional application can be an Application Load Balancer (ALB) or an API Gateway /// stage. /// </para> /// /// <para> /// For AWS CloudFront, don't use this call. Instead, use your CloudFront distribution /// configuration. To associate a Web ACL, in the CloudFront call <code>UpdateDistribution</code>, /// set the web ACL ID to the Amazon Resource Name (ARN) of the Web ACL. For information, /// see <a href="https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html">UpdateDistribution</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the AssociateWebACL service method.</param> /// /// <returns>The response from the AssociateWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/AssociateWebACL">REST API Reference for AssociateWebACL Operation</seealso> public virtual AssociateWebACLResponse AssociateWebACL(AssociateWebACLRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = AssociateWebACLRequestMarshaller.Instance; options.ResponseUnmarshaller = AssociateWebACLResponseUnmarshaller.Instance; return Invoke<AssociateWebACLResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Associates a Web ACL with a regional application resource, to protect the resource. /// A regional application can be an Application Load Balancer (ALB) or an API Gateway /// stage. /// </para> /// /// <para> /// For AWS CloudFront, don't use this call. Instead, use your CloudFront distribution /// configuration. To associate a Web ACL, in the CloudFront call <code>UpdateDistribution</code>, /// set the web ACL ID to the Amazon Resource Name (ARN) of the Web ACL. For information, /// see <a href="https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html">UpdateDistribution</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the AssociateWebACL service method.</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 AssociateWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/AssociateWebACL">REST API Reference for AssociateWebACL Operation</seealso> public virtual Task<AssociateWebACLResponse> AssociateWebACLAsync(AssociateWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = AssociateWebACLRequestMarshaller.Instance; options.ResponseUnmarshaller = AssociateWebACLResponseUnmarshaller.Instance; return InvokeAsync<AssociateWebACLResponse>(request, options, cancellationToken); } #endregion #region CheckCapacity /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Returns the web ACL capacity unit (WCU) requirements for a specified scope and set /// of rules. You can use this to check the capacity requirements for the rules you want /// to use in a <a>RuleGroup</a> or <a>WebACL</a>. /// </para> /// /// <para> /// AWS WAF uses WCUs to calculate and control the operating resources that are used to /// run your rules, rule groups, and web ACLs. AWS WAF calculates capacity differently /// for each rule type, to reflect the relative cost of each rule. Simple rules that cost /// little to run use fewer WCUs than more complex rules that use more processing power. /// Rule group capacity is fixed at creation, which helps users plan their web ACL WCU /// usage when they use a rule group. The WCU limit for web ACLs is 1,500. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CheckCapacity service method.</param> /// /// <returns>The response from the CheckCapacity service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/CheckCapacity">REST API Reference for CheckCapacity Operation</seealso> public virtual CheckCapacityResponse CheckCapacity(CheckCapacityRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = CheckCapacityRequestMarshaller.Instance; options.ResponseUnmarshaller = CheckCapacityResponseUnmarshaller.Instance; return Invoke<CheckCapacityResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Returns the web ACL capacity unit (WCU) requirements for a specified scope and set /// of rules. You can use this to check the capacity requirements for the rules you want /// to use in a <a>RuleGroup</a> or <a>WebACL</a>. /// </para> /// /// <para> /// AWS WAF uses WCUs to calculate and control the operating resources that are used to /// run your rules, rule groups, and web ACLs. AWS WAF calculates capacity differently /// for each rule type, to reflect the relative cost of each rule. Simple rules that cost /// little to run use fewer WCUs than more complex rules that use more processing power. /// Rule group capacity is fixed at creation, which helps users plan their web ACL WCU /// usage when they use a rule group. The WCU limit for web ACLs is 1,500. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CheckCapacity service method.</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 CheckCapacity service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/CheckCapacity">REST API Reference for CheckCapacity Operation</seealso> public virtual Task<CheckCapacityResponse> CheckCapacityAsync(CheckCapacityRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = CheckCapacityRequestMarshaller.Instance; options.ResponseUnmarshaller = CheckCapacityResponseUnmarshaller.Instance; return InvokeAsync<CheckCapacityResponse>(request, options, cancellationToken); } #endregion #region CreateIPSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates an <a>IPSet</a>, which you use to identify web requests that originate from /// specific IP addresses or ranges of IP addresses. For example, if you're receiving /// a lot of requests from a ranges of IP addresses, you can configure AWS WAF to block /// them using an IPSet that lists those IP addresses. /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates an <a>IPSet</a>, which you use to identify web requests that originate from /// specific IP addresses or ranges of IP addresses. For example, if you're receiving /// a lot of requests from a ranges of IP addresses, you can configure AWS WAF to block /// them using an IPSet that lists those IP addresses. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateIPSet service method.</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 CreateRegexPatternSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates a <a>RegexPatternSet</a>, which you reference in a <a>RegexPatternSetReferenceStatement</a>, /// to have AWS WAF inspect a web request component for the specified patterns. /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates a <a>RegexPatternSet</a>, which you reference in a <a>RegexPatternSetReferenceStatement</a>, /// to have AWS WAF inspect a web request component for the specified patterns. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateRegexPatternSet service method.</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 CreateRegexPatternSet service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 CreateRuleGroup /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates a <a>RuleGroup</a> per the specifications provided. /// </para> /// /// <para> /// A rule group defines a collection of rules to inspect and control web requests that /// you can use in a <a>WebACL</a>. When you create a rule group, you define an immutable /// capacity limit. If you update a rule group, you must stay within the capacity. This /// allows others to reuse the rule group with confidence in its capacity requirements. /// /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates a <a>RuleGroup</a> per the specifications provided. /// </para> /// /// <para> /// A rule group defines a collection of rules to inspect and control web requests that /// you can use in a <a>WebACL</a>. When you create a rule group, you define an immutable /// capacity limit. If you update a rule group, you must stay within the capacity. This /// allows others to reuse the rule group with confidence in its capacity requirements. /// /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateRuleGroup service method.</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 CreateRuleGroup service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 CreateWebACL /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates a <a>WebACL</a> per the specifications provided. /// </para> /// /// <para> /// A Web ACL defines a collection of rules to use to inspect and control web requests. /// Each rule has an action defined (allow, block, or count) for requests that match the /// statement of the rule. In the Web ACL, you assign a default action to take (allow, /// block) for any request that does not match any of the rules. The rules in a Web ACL /// can be a combination of the types <a>Rule</a>, <a>RuleGroup</a>, and managed rule /// group. You can associate a Web ACL with one or more AWS resources to protect. The /// resources can be Amazon CloudFront, an Amazon API Gateway API, or an Application Load /// Balancer. /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Creates a <a>WebACL</a> per the specifications provided. /// </para> /// /// <para> /// A Web ACL defines a collection of rules to use to inspect and control web requests. /// Each rule has an action defined (allow, block, or count) for requests that match the /// statement of the rule. In the Web ACL, you assign a default action to take (allow, /// block) for any request that does not match any of the rules. The rules in a Web ACL /// can be a combination of the types <a>Rule</a>, <a>RuleGroup</a>, and managed rule /// group. You can associate a Web ACL with one or more AWS resources to protect. The /// resources can be Amazon CloudFront, an Amazon API Gateway API, or an Application Load /// Balancer. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateWebACL service method.</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 CreateWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 DeleteFirewallManagerRuleGroups /// <summary> /// Deletes all rule groups that are managed by AWS Firewall Manager for the specified /// web ACL. /// /// /// <para> /// You can only use this if <code>ManagedByFirewallManager</code> is false in the specified /// <a>WebACL</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteFirewallManagerRuleGroups service method.</param> /// /// <returns>The response from the DeleteFirewallManagerRuleGroups service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/DeleteFirewallManagerRuleGroups">REST API Reference for DeleteFirewallManagerRuleGroups Operation</seealso> public virtual DeleteFirewallManagerRuleGroupsResponse DeleteFirewallManagerRuleGroups(DeleteFirewallManagerRuleGroupsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteFirewallManagerRuleGroupsRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteFirewallManagerRuleGroupsResponseUnmarshaller.Instance; return Invoke<DeleteFirewallManagerRuleGroupsResponse>(request, options); } /// <summary> /// Deletes all rule groups that are managed by AWS Firewall Manager for the specified /// web ACL. /// /// /// <para> /// You can only use this if <code>ManagedByFirewallManager</code> is false in the specified /// <a>WebACL</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteFirewallManagerRuleGroups service method.</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 DeleteFirewallManagerRuleGroups service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/DeleteFirewallManagerRuleGroups">REST API Reference for DeleteFirewallManagerRuleGroups Operation</seealso> public virtual Task<DeleteFirewallManagerRuleGroupsResponse> DeleteFirewallManagerRuleGroupsAsync(DeleteFirewallManagerRuleGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteFirewallManagerRuleGroupsRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteFirewallManagerRuleGroupsResponseUnmarshaller.Instance; return InvokeAsync<DeleteFirewallManagerRuleGroupsResponse>(request, options, cancellationToken); } #endregion #region DeleteIPSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>IPSet</a>. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>IPSet</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteIPSet service method.</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the <a>LoggingConfiguration</a> from the specified web ACL. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the <a>LoggingConfiguration</a> from the specified web ACL. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteLoggingConfiguration service method.</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 DeleteLoggingConfiguration service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 rule group. /// /// /// <para> /// You must be the owner of the rule group to perform this operation. /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// Permanently deletes an IAM policy from the specified rule group. /// /// /// <para> /// You must be the owner of the rule group to perform this operation. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeletePermissionPolicy service method.</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 DeletePermissionPolicy service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 DeleteRegexPatternSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>RegexPatternSet</a>. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>RegexPatternSet</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteRegexPatternSet service method.</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 DeleteRegexPatternSet service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 DeleteRuleGroup /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>RuleGroup</a>. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>RuleGroup</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteRuleGroup service method.</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 DeleteRuleGroup service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 DeleteWebACL /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>WebACL</a>. /// </para> /// /// <para> /// You can only use this if <code>ManagedByFirewallManager</code> is false in the specified /// <a>WebACL</a>. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Deletes the specified <a>WebACL</a>. /// </para> /// /// <para> /// You can only use this if <code>ManagedByFirewallManager</code> is false in the specified /// <a>WebACL</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteWebACL service method.</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFAssociatedItemException"> /// AWS WAF couldn’t perform the operation because your resource is being used by another /// resource or it’s associated with another resource. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 DescribeManagedRuleGroup /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Provides high-level information for a managed rule group, including descriptions of /// the rules. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeManagedRuleGroup service method.</param> /// /// <returns>The response from the DescribeManagedRuleGroup service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/DescribeManagedRuleGroup">REST API Reference for DescribeManagedRuleGroup Operation</seealso> public virtual DescribeManagedRuleGroupResponse DescribeManagedRuleGroup(DescribeManagedRuleGroupRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeManagedRuleGroupRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeManagedRuleGroupResponseUnmarshaller.Instance; return Invoke<DescribeManagedRuleGroupResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Provides high-level information for a managed rule group, including descriptions of /// the rules. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeManagedRuleGroup service method.</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 DescribeManagedRuleGroup service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/DescribeManagedRuleGroup">REST API Reference for DescribeManagedRuleGroup Operation</seealso> public virtual Task<DescribeManagedRuleGroupResponse> DescribeManagedRuleGroupAsync(DescribeManagedRuleGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeManagedRuleGroupRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeManagedRuleGroupResponseUnmarshaller.Instance; return InvokeAsync<DescribeManagedRuleGroupResponse>(request, options, cancellationToken); } #endregion #region DisassociateWebACL /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Disassociates a Web ACL from a regional application resource. A regional application /// can be an Application Load Balancer (ALB) or an API Gateway stage. /// </para> /// /// <para> /// For AWS CloudFront, don't use this call. Instead, use your CloudFront distribution /// configuration. To disassociate a Web ACL, provide an empty web ACL ID in the CloudFront /// call <code>UpdateDistribution</code>. For information, see <a href="https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html">UpdateDistribution</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DisassociateWebACL service method.</param> /// /// <returns>The response from the DisassociateWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/DisassociateWebACL">REST API Reference for DisassociateWebACL Operation</seealso> public virtual DisassociateWebACLResponse DisassociateWebACL(DisassociateWebACLRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DisassociateWebACLRequestMarshaller.Instance; options.ResponseUnmarshaller = DisassociateWebACLResponseUnmarshaller.Instance; return Invoke<DisassociateWebACLResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Disassociates a Web ACL from a regional application resource. A regional application /// can be an Application Load Balancer (ALB) or an API Gateway stage. /// </para> /// /// <para> /// For AWS CloudFront, don't use this call. Instead, use your CloudFront distribution /// configuration. To disassociate a Web ACL, provide an empty web ACL ID in the CloudFront /// call <code>UpdateDistribution</code>. For information, see <a href="https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html">UpdateDistribution</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DisassociateWebACL service method.</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 DisassociateWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/DisassociateWebACL">REST API Reference for DisassociateWebACL Operation</seealso> public virtual Task<DisassociateWebACLResponse> DisassociateWebACLAsync(DisassociateWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DisassociateWebACLRequestMarshaller.Instance; options.ResponseUnmarshaller = DisassociateWebACLResponseUnmarshaller.Instance; return InvokeAsync<DisassociateWebACLResponse>(request, options, cancellationToken); } #endregion #region GetIPSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>IPSet</a>. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>IPSet</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetIPSet service method.</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Returns the <a>LoggingConfiguration</a> for the specified web ACL. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Returns the <a>LoggingConfiguration</a> for the specified web ACL. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetLoggingConfiguration service method.</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 GetLoggingConfiguration service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 that is attached to the specified rule group. /// /// /// <para> /// You must be the owner of the rule group to perform this operation. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// Returns the IAM policy that is attached to the specified rule group. /// /// /// <para> /// You must be the owner of the rule group to perform this operation. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetPermissionPolicy service method.</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 GetPermissionPolicy service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 GetRateBasedStatementManagedKeys /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the keys that are currently blocked by a rate-based rule. The maximum number /// of managed keys that can be blocked for a single rate-based rule is 10,000. If more /// than 10,000 addresses exceed the rate limit, those with the highest rates are blocked. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetRateBasedStatementManagedKeys service method.</param> /// /// <returns>The response from the GetRateBasedStatementManagedKeys service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/GetRateBasedStatementManagedKeys">REST API Reference for GetRateBasedStatementManagedKeys Operation</seealso> public virtual GetRateBasedStatementManagedKeysResponse GetRateBasedStatementManagedKeys(GetRateBasedStatementManagedKeysRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetRateBasedStatementManagedKeysRequestMarshaller.Instance; options.ResponseUnmarshaller = GetRateBasedStatementManagedKeysResponseUnmarshaller.Instance; return Invoke<GetRateBasedStatementManagedKeysResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the keys that are currently blocked by a rate-based rule. The maximum number /// of managed keys that can be blocked for a single rate-based rule is 10,000. If more /// than 10,000 addresses exceed the rate limit, those with the highest rates are blocked. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetRateBasedStatementManagedKeys service method.</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 GetRateBasedStatementManagedKeys service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/GetRateBasedStatementManagedKeys">REST API Reference for GetRateBasedStatementManagedKeys Operation</seealso> public virtual Task<GetRateBasedStatementManagedKeysResponse> GetRateBasedStatementManagedKeysAsync(GetRateBasedStatementManagedKeysRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetRateBasedStatementManagedKeysRequestMarshaller.Instance; options.ResponseUnmarshaller = GetRateBasedStatementManagedKeysResponseUnmarshaller.Instance; return InvokeAsync<GetRateBasedStatementManagedKeysResponse>(request, options, cancellationToken); } #endregion #region GetRegexPatternSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>RegexPatternSet</a>. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>RegexPatternSet</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetRegexPatternSet service method.</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 GetRegexPatternSet service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 GetRuleGroup /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>RuleGroup</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>RuleGroup</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetRuleGroup service method.</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 GetRuleGroup service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// 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> /// /// <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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// 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> /// /// <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> /// <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 GetSampledRequests service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 GetWebACL /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>WebACL</a>. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the specified <a>WebACL</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetWebACL service method.</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 GetWebACLForResource /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the <a>WebACL</a> for the specified resource. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetWebACLForResource service method.</param> /// /// <returns>The response from the GetWebACLForResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/GetWebACLForResource">REST API Reference for GetWebACLForResource Operation</seealso> public virtual GetWebACLForResourceResponse GetWebACLForResource(GetWebACLForResourceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetWebACLForResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = GetWebACLForResourceResponseUnmarshaller.Instance; return Invoke<GetWebACLForResourceResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the <a>WebACL</a> for the specified resource. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetWebACLForResource service method.</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 GetWebACLForResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/GetWebACLForResource">REST API Reference for GetWebACLForResource Operation</seealso> public virtual Task<GetWebACLForResourceResponse> GetWebACLForResourceAsync(GetWebACLForResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetWebACLForResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = GetWebACLForResourceResponseUnmarshaller.Instance; return InvokeAsync<GetWebACLForResourceResponse>(request, options, cancellationToken); } #endregion #region ListAvailableManagedRuleGroups /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of managed rule groups that are available for you to use. This /// list includes all AWS Managed Rules rule groups and the AWS Marketplace managed rule /// groups that you're subscribed to. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListAvailableManagedRuleGroups service method.</param> /// /// <returns>The response from the ListAvailableManagedRuleGroups service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/ListAvailableManagedRuleGroups">REST API Reference for ListAvailableManagedRuleGroups Operation</seealso> public virtual ListAvailableManagedRuleGroupsResponse ListAvailableManagedRuleGroups(ListAvailableManagedRuleGroupsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListAvailableManagedRuleGroupsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListAvailableManagedRuleGroupsResponseUnmarshaller.Instance; return Invoke<ListAvailableManagedRuleGroupsResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of managed rule groups that are available for you to use. This /// list includes all AWS Managed Rules rule groups and the AWS Marketplace managed rule /// groups that you're subscribed to. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListAvailableManagedRuleGroups service method.</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 ListAvailableManagedRuleGroups service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/ListAvailableManagedRuleGroups">REST API Reference for ListAvailableManagedRuleGroups Operation</seealso> public virtual Task<ListAvailableManagedRuleGroupsResponse> ListAvailableManagedRuleGroupsAsync(ListAvailableManagedRuleGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListAvailableManagedRuleGroupsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListAvailableManagedRuleGroupsResponseUnmarshaller.Instance; return InvokeAsync<ListAvailableManagedRuleGroupsResponse>(request, options, cancellationToken); } #endregion #region ListIPSets /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>IPSetSummary</a> objects for the IP sets that you manage. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>IPSetSummary</a> objects for the IP sets that you manage. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListIPSets service method.</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 ListIPSets service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of your <a>LoggingConfiguration</a> objects. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of your <a>LoggingConfiguration</a> objects. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListLoggingConfigurations service method.</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 ListLoggingConfigurations service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 ListRegexPatternSets /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>RegexPatternSetSummary</a> objects for the regex pattern /// sets that you manage. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>RegexPatternSetSummary</a> objects for the regex pattern /// sets that you manage. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListRegexPatternSets service method.</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 ListRegexPatternSets service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 ListResourcesForWebACL /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of the Amazon Resource Names (ARNs) for the regional resources /// that are associated with the specified web ACL. If you want the list of AWS CloudFront /// resources, use the AWS CloudFront call <code>ListDistributionsByWebACLId</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListResourcesForWebACL service method.</param> /// /// <returns>The response from the ListResourcesForWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/ListResourcesForWebACL">REST API Reference for ListResourcesForWebACL Operation</seealso> public virtual ListResourcesForWebACLResponse ListResourcesForWebACL(ListResourcesForWebACLRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListResourcesForWebACLRequestMarshaller.Instance; options.ResponseUnmarshaller = ListResourcesForWebACLResponseUnmarshaller.Instance; return Invoke<ListResourcesForWebACLResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of the Amazon Resource Names (ARNs) for the regional resources /// that are associated with the specified web ACL. If you want the list of AWS CloudFront /// resources, use the AWS CloudFront call <code>ListDistributionsByWebACLId</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListResourcesForWebACL service method.</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 ListResourcesForWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/ListResourcesForWebACL">REST API Reference for ListResourcesForWebACL Operation</seealso> public virtual Task<ListResourcesForWebACLResponse> ListResourcesForWebACLAsync(ListResourcesForWebACLRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListResourcesForWebACLRequestMarshaller.Instance; options.ResponseUnmarshaller = ListResourcesForWebACLResponseUnmarshaller.Instance; return InvokeAsync<ListResourcesForWebACLResponse>(request, options, cancellationToken); } #endregion #region ListRuleGroups /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>RuleGroupSummary</a> objects for the rule groups that you /// manage. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>RuleGroupSummary</a> objects for the rule groups that you /// manage. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListRuleGroups service method.</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 ListRuleGroups service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 ListTagsForResource /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the <a>TagInfoForResource</a> for the specified resource. Tags are key:value /// pairs that you can use to categorize and manage your resources, for purposes like /// billing. For example, you might set the tag key to "customer" and the value to the /// customer name or ID. You can specify one or more tags to add to each AWS resource, /// up to 50 tags for a resource. /// </para> /// /// <para> /// You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule groups, /// IP sets, and regex pattern sets. You can't manage or view tags through the AWS WAF /// console. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param> /// /// <returns>The response from the ListTagsForResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso> public virtual ListTagsForResourceResponse ListTagsForResource(ListTagsForResourceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance; return Invoke<ListTagsForResourceResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves the <a>TagInfoForResource</a> for the specified resource. Tags are key:value /// pairs that you can use to categorize and manage your resources, for purposes like /// billing. For example, you might set the tag key to "customer" and the value to the /// customer name or ID. You can specify one or more tags to add to each AWS resource, /// up to 50 tags for a resource. /// </para> /// /// <para> /// You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule groups, /// IP sets, and regex pattern sets. You can't manage or view tags through the AWS WAF /// console. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</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 ListTagsForResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso> public virtual Task<ListTagsForResourceResponse> ListTagsForResourceAsync(ListTagsForResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance; return InvokeAsync<ListTagsForResourceResponse>(request, options, cancellationToken); } #endregion #region ListWebACLs /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>WebACLSummary</a> objects for the web ACLs that you manage. /// </para> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Retrieves an array of <a>WebACLSummary</a> objects for the web ACLs that you manage. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListWebACLs service method.</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 ListWebACLs service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 PutLoggingConfiguration /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Enables the specified <a>LoggingConfiguration</a>, to start logging from a web ACL, /// according to the configuration provided. /// </para> /// /// <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. /// If you are capturing logs for Amazon CloudFront, always create the firehose in US /// East (N. Virginia). /// </para> /// /// <para> /// Give the data firehose a name that starts with the prefix <code>aws-waf-logs-</code>. /// For example, <code>aws-waf-logs-us-east-2-analytics</code>. /// </para> /// <note> /// <para> /// Do not create the data firehose using a <code>Kinesis stream</code> as your source. /// </para> /// </note> </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.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 call to <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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Enables the specified <a>LoggingConfiguration</a>, to start logging from a web ACL, /// according to the configuration provided. /// </para> /// /// <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. /// If you are capturing logs for Amazon CloudFront, always create the firehose in US /// East (N. Virginia). /// </para> /// /// <para> /// Give the data firehose a name that starts with the prefix <code>aws-waf-logs-</code>. /// For example, <code>aws-waf-logs-us-east-2-analytics</code>. /// </para> /// <note> /// <para> /// Do not create the data firehose using a <code>Kinesis stream</code> as your source. /// </para> /// </note> </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> /// <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 PutLoggingConfiguration service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.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 call to <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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 an IAM policy to the specified resource. Use this to share a rule group across /// accounts. /// /// /// <para> /// You must be the owner of the rule group to perform this operation. /// </para> /// /// <para> /// This action 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 ARN in the request must be a valid WAF <a>RuleGroup</a> ARN and the rule group /// must exist in the same region. /// </para> /// </li> <li> /// <para> /// The user making the request must be the owner of the rule group. /// </para> /// </li> </ul> /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidPermissionPolicyException"> /// The operation failed because the specified policy isn't in the proper format. /// /// /// <para> /// The policy specifications must conform to the following: /// </para> /// <ul> <li> /// <para> /// The policy must be composed using IAM Policy version 2012-10-17 or version 2015-01-01. /// </para> /// </li> <li> /// <para> /// The policy must include specifications for <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> /// <code>Action</code> must specify <code>wafv2:CreateWebACL</code>, <code>wafv2:UpdateWebACL</code>, /// and <code>wafv2:PutFirewallManagerRuleGroups</code>. AWS WAF rejects any extra actions /// or wildcard actions in the policy. /// </para> /// </li> <li> /// <para> /// The policy must not include a <code>Resource</code> parameter. /// </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> /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// Attaches an IAM policy to the specified resource. Use this to share a rule group across /// accounts. /// /// /// <para> /// You must be the owner of the rule group to perform this operation. /// </para> /// /// <para> /// This action 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 ARN in the request must be a valid WAF <a>RuleGroup</a> ARN and the rule group /// must exist in the same region. /// </para> /// </li> <li> /// <para> /// The user making the request must be the owner of the rule group. /// </para> /// </li> </ul> /// </summary> /// <param name="request">Container for the necessary parameters to execute the PutPermissionPolicy service method.</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 PutPermissionPolicy service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidPermissionPolicyException"> /// The operation failed because the specified policy isn't in the proper format. /// /// /// <para> /// The policy specifications must conform to the following: /// </para> /// <ul> <li> /// <para> /// The policy must be composed using IAM Policy version 2012-10-17 or version 2015-01-01. /// </para> /// </li> <li> /// <para> /// The policy must include specifications for <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> /// <code>Action</code> must specify <code>wafv2:CreateWebACL</code>, <code>wafv2:UpdateWebACL</code>, /// and <code>wafv2:PutFirewallManagerRuleGroups</code>. AWS WAF rejects any extra actions /// or wildcard actions in the policy. /// </para> /// </li> <li> /// <para> /// The policy must not include a <code>Resource</code> parameter. /// </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> /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 TagResource /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Associates tags with the specified AWS resource. Tags are key:value pairs that you /// can use to categorize and manage your resources, for purposes like billing. For example, /// you might set the tag key to "customer" and the value to the customer name or ID. /// You can specify one or more tags to add to each AWS resource, up to 50 tags for a /// resource. /// </para> /// /// <para> /// You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule groups, /// IP sets, and regex pattern sets. You can't manage or view tags through the AWS WAF /// console. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param> /// /// <returns>The response from the TagResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/TagResource">REST API Reference for TagResource Operation</seealso> public virtual TagResourceResponse TagResource(TagResourceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = TagResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance; return Invoke<TagResourceResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Associates tags with the specified AWS resource. Tags are key:value pairs that you /// can use to categorize and manage your resources, for purposes like billing. For example, /// you might set the tag key to "customer" and the value to the customer name or ID. /// You can specify one or more tags to add to each AWS resource, up to 50 tags for a /// resource. /// </para> /// /// <para> /// You can tag the AWS resources that you manage through AWS WAF: web ACLs, rule groups, /// IP sets, and regex pattern sets. You can't manage or view tags through the AWS WAF /// console. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the TagResource service method.</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 TagResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/TagResource">REST API Reference for TagResource Operation</seealso> public virtual Task<TagResourceResponse> TagResourceAsync(TagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = TagResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance; return InvokeAsync<TagResourceResponse>(request, options, cancellationToken); } #endregion #region UntagResource /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Disassociates tags from an AWS resource. Tags are key:value pairs that you can associate /// with AWS resources. For example, the tag key might be "customer" and the tag value /// might be "companyA." You can specify one or more tags to add to each container. You /// can add up to 50 tags to each AWS resource. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param> /// /// <returns>The response from the UntagResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/UntagResource">REST API Reference for UntagResource Operation</seealso> public virtual UntagResourceResponse UntagResource(UntagResourceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = UntagResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance; return Invoke<UntagResourceResponse>(request, options); } /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Disassociates tags from an AWS resource. Tags are key:value pairs that you can associate /// with AWS resources. For example, the tag key might be "customer" and the tag value /// might be "companyA." You can specify one or more tags to add to each container. You /// can add up to 50 tags to each AWS resource. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</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 UntagResource service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationException"> /// An error occurred during the tagging operation. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFTagOperationInternalErrorException"> /// AWS WAF couldn’t perform your tagging operation because of an internal error. Retry /// your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/UntagResource">REST API Reference for UntagResource Operation</seealso> public virtual Task<UntagResourceResponse> UntagResourceAsync(UntagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = UntagResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance; return InvokeAsync<UntagResourceResponse>(request, options, cancellationToken); } #endregion #region UpdateIPSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>IPSet</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>IPSet</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateIPSet service method.</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 UpdateRegexPatternSet /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>RegexPatternSet</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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>RegexPatternSet</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateRegexPatternSet service method.</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 UpdateRegexPatternSet service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 UpdateRuleGroup /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>RuleGroup</a>. /// </para> /// /// <para> /// A rule group defines a collection of rules to inspect and control web requests that /// you can use in a <a>WebACL</a>. When you create a rule group, you define an immutable /// capacity limit. If you update a rule group, you must stay within the capacity. This /// allows others to reuse the rule group with confidence in its capacity requirements. /// /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>RuleGroup</a>. /// </para> /// /// <para> /// A rule group defines a collection of rules to inspect and control web requests that /// you can use in a <a>WebACL</a>. When you create a rule group, you define an immutable /// capacity limit. If you update a rule group, you must stay within the capacity. This /// allows others to reuse the rule group with confidence in its capacity requirements. /// /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateRuleGroup service method.</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 UpdateRuleGroup service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 UpdateWebACL /// <summary> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>WebACL</a>. /// </para> /// /// <para> /// A Web ACL defines a collection of rules to use to inspect and control web requests. /// Each rule has an action defined (allow, block, or count) for requests that match the /// statement of the rule. In the Web ACL, you assign a default action to take (allow, /// block) for any request that does not match any of the rules. The rules in a Web ACL /// can be a combination of the types <a>Rule</a>, <a>RuleGroup</a>, and managed rule /// group. You can associate a Web ACL with one or more AWS resources to protect. The /// resources can be Amazon CloudFront, an Amazon API Gateway API, or an Application Load /// Balancer. /// </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 WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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> /// <note> /// <para> /// This is the latest version of <b>AWS WAF</b>, named AWS WAFV2, released in November, /// 2019. For information, including how to migrate your AWS WAF resources from the prior /// release, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS /// WAF Developer Guide</a>. /// </para> /// </note> /// <para> /// Updates the specified <a>WebACL</a>. /// </para> /// /// <para> /// A Web ACL defines a collection of rules to use to inspect and control web requests. /// Each rule has an action defined (allow, block, or count) for requests that match the /// statement of the rule. In the Web ACL, you assign a default action to take (allow, /// block) for any request that does not match any of the rules. The rules in a Web ACL /// can be a combination of the types <a>Rule</a>, <a>RuleGroup</a>, and managed rule /// group. You can associate a Web ACL with one or more AWS resources to protect. The /// resources can be Amazon CloudFront, an Amazon API Gateway API, or an Application Load /// Balancer. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateWebACL service method.</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 UpdateWebACL service method, as returned by WAFV2.</returns> /// <exception cref="Amazon.WAFV2.Model.WAFDuplicateItemException"> /// AWS WAF couldn’t perform the operation because the resource that you tried to save /// is a duplicate of an existing one. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInternalErrorException"> /// Your request is valid, but AWS WAF couldn’t perform the operation because of a system /// problem. Retry your request. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFInvalidOperationException"> /// The operation isn't valid. /// </exception> /// <exception cref="Amazon.WAFV2.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 or value. /// </para> /// </li> <li> /// <para> /// Your nested statement isn't valid. You might have tried to nest a statement that can’t /// be nested. /// </para> /// </li> <li> /// <para> /// You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that isn't /// among the types available at <a>DefaultAction</a>. /// </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.WAFV2.Model.WAFInvalidResourceException"> /// AWS WAF couldn’t perform the operation because the resource that you requested isn’t /// valid. Check the resource, and try again. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFLimitsExceededException"> /// AWS WAF couldn’t perform the operation because you exceeded your 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.WAFV2.Model.WAFNonexistentItemException"> /// AWS WAF couldn’t perform the operation because your resource doesn’t exist. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFOptimisticLockException"> /// AWS WAF couldn’t save your changes because you tried to update or delete a resource /// that has changed since you last retrieved it. Get the resource again, make any changes /// you need to make to the new copy, and retry your operation. /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFSubscriptionNotFoundException"> /// /// </exception> /// <exception cref="Amazon.WAFV2.Model.WAFUnavailableEntityException"> /// AWS WAF couldn’t retrieve the resource that you requested. Retry your request. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/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 } }
50.692213
239
0.612653
[ "Apache-2.0" ]
DetlefGolze/aws-sdk-net
sdk/src/Services/WAFV2/Generated/_bcl45/AmazonWAFV2Client.cs
331,564
C#
using System; namespace Microsoft.DotnetOrg.GitHubCaching { public readonly struct CachedAccessReason { public static CachedAccessReason FromOwner => new CachedAccessReason(isOwner: true, isCollaborator: false, null); public static CachedAccessReason FromCollaborator => new CachedAccessReason(isOwner: false, isCollaborator: true, null); public static CachedAccessReason FromTeam(CachedTeam team) { if (team is null) throw new ArgumentNullException(nameof(team)); return new CachedAccessReason(isOwner: false, isCollaborator: false, team); } private CachedAccessReason(bool isOwner, bool isCollaborator, CachedTeam? team) { IsOwner = isOwner; IsCollaborator = isCollaborator; Team = team; } public bool IsOwner { get; } public bool IsCollaborator { get; } public CachedTeam? Team { get; } public override string ToString() { if (IsOwner) return "(Owner)"; if (IsCollaborator) return "(Collaborator)"; return Team!.GetFullName(); } } }
30.3
128
0.610561
[ "MIT" ]
ScriptBox21/dotnet-org-policy
src/Microsoft.DotnetOrg.GitHubCaching/CachedAccessReason.cs
1,214
C#
using System; using System.Collections.Generic; using System.Text; namespace JT1078.Hls.Enums { /// <summary> /// 取0x50表示包含PCR或0x40表示不包含PCR /// 注意:关键帧需要加pcr /// </summary> public enum PCRInclude:byte { 包含= 0x50, 不包含= 0x40 } }
16
33
0.606618
[ "MIT" ]
AlohaChina/JT1078
src/JT1078.Hls/Enums/PCRInclude.cs
322
C#
using Swagger.ObjectModel.Builders; using Xunit; namespace Swagger.ObjectModel.Tests.Builders { public class HeaderBuilderTest { private readonly HeaderBuilder builder; public HeaderBuilderTest() { this.builder = new HeaderBuilder(); } [Fact] public void Should_ReturnEmptyHeader_WhenSetNothing() { var header = builder.Build(); Assert.NotNull(header); Assert.Null(header.Description); Assert.Null(header.Default); } [Fact] public void Should_AbleToSetDescription() { string description = "description"; var header = builder.Description(description).Build(); Assert.NotNull(header); Assert.Equal(description,header.Description); } [Fact] public void Should_AbleToSetDefaultOfDataType() { object defaultValue = new object(); var header = builder.Default(defaultValue).Build(); Assert.NotNull(header); Assert.Equal(defaultValue, header.Default); } } }
25.6875
66
0.548256
[ "MIT" ]
ThiagoBarradas/Nancy.Swagger
test/Swagger.ObjectModel.Tests/Builders/HeaderBuilderTest.cs
1,235
C#
using MoarUtils.commands.logging; using Newtonsoft.Json; using RestSharp; using System; using System.Net; using System.Threading; namespace MoarUtils.Utils.GoogleAuth { public class GetUserInfo { public class request { public string clientId { get; set; } public string clientSecret { get; set; } public string refreshToken { get; set; } } public class response { public string accessToken { get; set; } public string email { get; set; } public string picture { get; set; } public string id { get; set; } public bool verifiedEmail { get; set; } } public static void Execute( request m, out response r, out HttpStatusCode hsc, out string status, CancellationToken? ct = null ) { r = new response { }; status = ""; hsc = HttpStatusCode.BadRequest; var content = ""; try { if (string.IsNullOrEmpty(m.refreshToken)) { status = "refresh token is required"; hsc = HttpStatusCode.BadRequest; return; } GetNewAccessTokenFromRefreshToken.Execute( hsc: out hsc, status: out status, m: new GetNewAccessTokenFromRefreshToken.request { clientId = m.clientId, refreshToken = m.refreshToken, clientSecret = m.clientSecret, }, r: out GetNewAccessTokenFromRefreshToken.response r1, ct: ct ); if (hsc != HttpStatusCode.OK) { status = "unable to GetNewAccessTokenFromRefreshToken"; hsc = HttpStatusCode.BadRequest; return; } r.accessToken = r1.access_token; var client = new RestClient("https://www.googleapis.com/"); var request = new RestRequest("oauth2/v2/userinfo", Method.Get); request.AddHeader("Authorization", "Bearer " + r.accessToken); //Authorization: Bearer XXX var response = client.ExecuteAsync(request).Result; if (response.StatusCode != HttpStatusCode.OK) { status = $"StatusCode was {response.StatusCode}"; hsc = HttpStatusCode.BadRequest; return; } if (response.ErrorException != null) { status = $"response had error exception: {response.ErrorException.Message}"; hsc = HttpStatusCode.BadRequest; return; } if (string.IsNullOrWhiteSpace(response.Content)) { status = $"content was empty"; hsc = HttpStatusCode.BadRequest; return; } content = response.Content; dynamic json = JsonConvert.DeserializeObject(content); #region cheat sheet //{ // { // "id": "123456789012345678901", // "email": "foo@bar.baz", // "verified_email": true, // "picture": "https://lh3.googleusercontent.com/a-/1111111111111111111111111111111111111111111111" // } //} #endregion r.email = json.email == null ? null : json.email.Value ; r.picture = json.picture == null ? null : json.picture.Value ; r.id = json.id == null ? null : json.id.Value ; r.verifiedEmail = json.verified_email == null ? false : json.verified_email.Value ; hsc = HttpStatusCode.OK; return; } catch (Exception ex) { status = "unepxected error"; //was: errorMsg = ex.Message; hsc = HttpStatusCode.InternalServerError; LogIt.E(ex); return; } finally { LogIt.I(JsonConvert.SerializeObject(new { hsc, status, //m, //logging //content, //logging //r, r.email, r.picture, r.verifiedEmail, }, Formatting.Indented)); } } } }
28.977778
110
0.561605
[ "MIT" ]
BlarghLabs/moarutils
commands/googleauth/GetUserInfo.cs
3,914
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("Demo1")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Demo1")] [assembly: AssemblyCopyright("Copyright © Microsoft 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("37a6f9ba-b485-47f9-89f8-a7c7015b64ac")] // 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.864865
84
0.745896
[ "MIT" ]
NadiaKaradjova/SoftUni
C# Advanced/Stacks and Queues -Exercises/Demo1/Properties/AssemblyInfo.cs
1,404
C#
// Copyright (c) 2022 AccelByte Inc. All Rights Reserved. // This is licensed software from AccelByte Inc, for limitations // and restrictions contact your company contract manager. // This code is generated by tool. DO NOT EDIT. using System.Text.Json.Serialization; using AccelByte.Sdk.Core; using AccelByte.Sdk.Core.Converters; namespace AccelByte.Sdk.Api.Social.Model { public class StatInfo : AccelByte.Sdk.Core.Model { [JsonPropertyName("createdAt")] public DateTime? CreatedAt { get; set; } [JsonPropertyName("defaultValue")] public double? DefaultValue { get; set; } [JsonPropertyName("description")] public string? Description { get; set; } [JsonPropertyName("incrementOnly")] public bool? IncrementOnly { get; set; } [JsonPropertyName("maximum")] public double? Maximum { get; set; } [JsonPropertyName("minimum")] public double? Minimum { get; set; } [JsonPropertyName("name")] public string? Name { get; set; } [JsonPropertyName("namespace")] public string? Namespace { get; set; } [JsonPropertyName("setAsGlobal")] public bool? SetAsGlobal { get; set; } [JsonPropertyName("setBy")] [JsonStringEnum] public StatInfoSetBy? SetBy { get; set; } [JsonPropertyName("statCode")] public string? StatCode { get; set; } [JsonPropertyName("status")] [JsonStringEnum] public StatInfoStatus? Status { get; set; } [JsonPropertyName("tags")] public List<string>? Tags { get; set; } [JsonPropertyName("updatedAt")] public DateTime? UpdatedAt { get; set; } } public class StatInfoSetBy : StringEnum<StatInfoSetBy> { public static readonly StatInfoSetBy CLIENT = new StatInfoSetBy("CLIENT"); public static readonly StatInfoSetBy SERVER = new StatInfoSetBy("SERVER"); public static implicit operator StatInfoSetBy(string value) { return Create(value); } public StatInfoSetBy(string enumValue) : base(enumValue) { } } public class StatInfoStatus : StringEnum<StatInfoStatus> { public static readonly StatInfoStatus INIT = new StatInfoStatus("INIT"); public static readonly StatInfoStatus TIED = new StatInfoStatus("TIED"); public static implicit operator StatInfoStatus(string value) { return Create(value); } public StatInfoStatus(string enumValue) : base(enumValue) { } } }
26.762376
68
0.613762
[ "MIT" ]
AccelByte/accelbyte-csharp-sdk
AccelByte.Sdk/Api/Social/Model/StatInfo.cs
2,703
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using FluentAssertions; using Microsoft.ReverseProxy.Common.Util; using Xunit; namespace Microsoft.ReverseProxy.Common.Tests { public class TimeSpanIso8601Tests { [Theory] [InlineData("P0Y0M0DT0H0M0S", 0, 0, 0, 0)] [InlineData("PT0S", 0, 0, 0, 0)] [InlineData("P0Y0M0DT0H0M1S", 0, 0, 0, 1)] [InlineData("PT0H1S", 0, 0, 0, 1)] [InlineData("PT5S", 0, 0, 0, 5)] [InlineData("P1D", 1, 0, 0, 0)] [InlineData("P1DT1M", 1, 0, 1, 0)] [InlineData("P1Y", 365, 0, 0, 0)] public void Constructor_ParsesStringCorrectly(string iso8601String, int expectedDays, int expectedHours, int expectedMinutes, int expectedSeconds) { // Act var timeSpan = new TimeSpanIso8601(iso8601String); // Assert timeSpan.Value.Should().Be(new TimeSpan(expectedDays, expectedHours, expectedMinutes, expectedSeconds)); } } }
29.714286
154
0.622115
[ "MIT" ]
rinku2028/reverse-proxy
test/ReverseProxy.Common.Tests/Util/TimeSpanIso8601Tests.cs
1,042
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; namespace sample_artifact_docker.Pages { public class IndexModel : PageModel { private readonly ILogger<IndexModel> _logger; public IndexModel(ILogger<IndexModel> logger) { _logger = logger; } public void OnGet() { } } }
19.769231
53
0.675097
[ "MIT" ]
demoserievideo/sample-artifact-docker
Pages/Index.cshtml.cs
516
C#
namespace WebMoney.XmlInterfaces.BasicObjects { public enum Language { En, Ru } }
13.75
46
0.581818
[ "MIT" ]
MarketKernel/webmoney-api
WebMoney.XmlInterfaces/BasicObjects/Language.cs
112
C#
/* Copyright (c) 2005 Poderosa Project, All Rights Reserved. This file is a part of the Granados SSH Client Library that is subject to the license included in the distributed package. You may not use this file except in compliance with the license. * $Id: AssemblyInfo.cs,v 1.6 2011/10/27 23:21:56 kzmi Exp $ */ using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Granados")] [assembly: AssemblyDescription("SSH Client Library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("2.0.0")] [assembly: AssemblyDelaySign(false)]
30.083333
74
0.756233
[ "Apache-2.0" ]
FNKGino/poderosa
Granados/AssemblyInfo.cs
724
C#
using AutoMapper; using Microsoft.EntityFrameworkCore; using SaTeatar.Database; using SaTeatar.Model.Models; using SaTeatar.Model.Requests; using SaTeatar.WebAPI.Services; using System; using System.Collections.Generic; using System.Data.SqlTypes; using System.Linq; using System.Threading.Tasks; namespace SaTeatar.Services { public class KarteService : BaseCRUDService<mKarta, Karte, rKartaSearch, rKartaInsert, rKartaUpdate> , IKarteService { public KarteService(SaTeatarBpContext context, IMapper mapper) : base(context, mapper) { } public override mKarta GetById(int id) { var upit = _context.Karte.Include(x => x.Izvodjenje.Predstava).Include(x => x.Izvodjenje.Pozoriste).Include(y => y.IzvodjenjeZona.Zona).Include(x => x.Kupac).AsQueryable(); var karta = upit.Where(x => x.KartaId == id).FirstOrDefaultAsync(); mKarta mk = new mKarta() { KartaId = karta.Result.KartaId, KupacId=karta.Result.KupacId, IzvodjenjeId=karta.Result.IzvodjenjeId, IzvodjenjeZonaId=karta.Result.IzvodjenjeZonaId, Qrcode=karta.Result.Qrcode, PredstavaNaziv = karta.Result.Izvodjenje.Predstava.Naziv, PozoristeNaziv = karta.Result.Izvodjenje.Pozoriste.Naziv, Cijena = karta.Result.IzvodjenjeZona.Cijena, BrKarte = karta.Result.BrKarte, ZonaNaziv = karta.Result.IzvodjenjeZona.Zona.Naziv, Placeno=karta.Result.Placeno, DatumIzvodjenja=karta.Result.Izvodjenje.DatumVrijeme, }; return mk; } public override IList<mKarta> Get(rKartaSearch search) { if (search.DatumOd.CompareTo(DateTime.MinValue.AddHours(1)) > 0 && search.DatumDo.CompareTo(DateTime.MinValue.AddHours(1)) > 0) { var upitn = _context.NarudzbaStavke.Include(x => x.Narudzba).Include(x => x.Karta).Include(x=>x.Karta.Kupac).AsQueryable(); upitn = upitn.Where(x =>x.Karta.Izvodjenje.PozoristeId==search.PozoristeId && x.Karta.Placeno==true && x.Narudzba.Datum.CompareTo(search.DatumOd) >= 0 && x.Narudzba.Datum.CompareTo(search.DatumDo) <= 0); var lk = upitn.Select(x => x.Karta).ToList(); return _mapper.Map<List<mKarta>>(lk); } else { var upit = _context.Karte.Include(x => x.Izvodjenje.Predstava).Include(x => x.Izvodjenje.Pozoriste).Include(y => y.IzvodjenjeZona.Zona).Include(x => x.Kupac).AsQueryable(); if (search.KupacId != 0) { upit = upit.Where(x => x.KupacId == search.KupacId); } if (search.IzvodjenjeZonaId != 0) { upit = upit.Where(x => x.IzvodjenjeZonaId == search.IzvodjenjeZonaId); } if (search.PredstavaId != 0) { upit = upit.Where(x => x.Izvodjenje.PredstavaId == search.PredstavaId); } if (search.PozoristeId != 0) { upit = upit.Where(x => x.Izvodjenje.PozoristeId == search.PozoristeId); } upit = upit.Where(x => x.Placeno == search.Placeno); var lista = upit.ToList(); var mlista = _mapper.Map<List<mKarta>>(lista); foreach (var item in upit) { foreach (var k in mlista) { if (item.KartaId == k.KartaId) { k.PredstavaNaziv = item.Izvodjenje.Predstava.Naziv; k.PredstavaId = item.Izvodjenje.Predstava.PredstavaId; k.PozoristeId = item.Izvodjenje.Pozoriste.PozoristeId; k.PozoristeNaziv = item.Izvodjenje.Pozoriste.Naziv; k.ZonaNaziv = item.IzvodjenjeZona.Zona.Naziv; k.Cijena = item.IzvodjenjeZona.Cijena; k.DatumIzvodjenja = item.Izvodjenje.DatumVrijeme; } } } return mlista; } } } }
39.887931
189
0.518695
[ "MIT" ]
eminafit/SaTeatar
SaTeatar/SaTeatar/Services/KarteService.cs
4,629
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; using System.Runtime.InteropServices; internal static partial class Interop { /// <summary> /// Validates the result of system call that returns greater than or equal to 0 on success /// and less than 0 on failure, with errno set to the error code. /// If the system call failed due to interruption (EINTR), true is returned and /// the caller should (usually) retry. If the system call failed for any other reason, /// an exception is thrown. Otherwise, the system call succeeded, and false is returned. /// </summary> /// <param name="result">The result of the system call.</param> /// <param name="path">The path with which this error is associated. This may be null.</param> /// <param name="isDirectory">true if the <paramref name="path"/> is known to be a directory; otherwise, false.</param> /// <param name="errorRewriter">Optional function to change an error code prior to processing it.</param> /// <returns> /// true if the system call should be retried due to it being interrupted; otherwise, false. /// An exception will be thrown if the system call failed for any reason other than interruption. /// </returns> internal static bool CheckIo(long result, string path = null, bool isDirectory = false, Func<int, int> errorRewriter = null) { if (result < 0) { int errno = Marshal.GetLastWin32Error(); if (errorRewriter != null) { errno = errorRewriter(errno); } if (errno != Interop.Errors.EINTR) { throw Interop.GetExceptionForIoErrno(errno, path, isDirectory); } return true; } return false; } /// <summary> /// Validates the result of system call that returns a non-zero pointer on success /// and a zero pointer on failure. /// If the system call failed due to interruption (EINTR), true is returned and /// the caller should (usually) retry. If the system call failed for any other reason, /// an exception is thrown. Otherwise, the system call succeeded, and false is returned. /// </summary> internal static bool CheckIoPtr(IntPtr ptr, string path = null, bool isDirectory = false) { return CheckIo(ptr == IntPtr.Zero ? -1 : 0, path, isDirectory); } /// <summary> /// Gets an Exception to represent the supplied errno error code. /// </summary> /// <param name="errno">The error code</param> /// <param name="path">The path with which this error is associated. This may be null.</param> /// <param name="isDirectory">true if the <paramref name="path"/> is known to be a directory; otherwise, false.</param> /// <returns></returns> internal static Exception GetExceptionForIoErrno(int errno, string path = null, bool isDirectory = false) { switch (errno) { case Errors.ENOENT: if (isDirectory) { return !string.IsNullOrEmpty(path) ? new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path)) : new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName); } else { return !string.IsNullOrEmpty(path) ? new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path) : new FileNotFoundException(SR.IO_FileNotFound); } case Errors.EACCES: case Errors.EBADF: case Errors.EPERM: return !string.IsNullOrEmpty(path) ? new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path)) : new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName); case Errors.ENAMETOOLONG: return new PathTooLongException(SR.IO_PathTooLong); case Errors.EWOULDBLOCK: return !string.IsNullOrEmpty(path) ? new IOException(SR.Format(SR.IO_SharingViolation_File, path), errno) : new IOException(SR.IO_SharingViolation_NoFileName, errno); case Errors.ECANCELED: return new OperationCanceledException(); case Errors.EFBIG: return new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_FileLengthTooBig); case Errors.EEXIST: if (!string.IsNullOrEmpty(path)) { return new IOException(SR.Format(SR.IO_FileExists_Name, path), errno); } goto default; default: return GetIOException(errno); } } internal static Exception GetIOException(int errno) { return new IOException(libc.strerror(errno), errno); } }
43.516949
128
0.615579
[ "MIT" ]
bpschoch/corefx
src/Common/src/Interop/Unix/Interop.IOErrors.cs
5,135
C#
using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Text; namespace Aveezo; public sealed class SqlSelectProto : SqlBase { #region Fields public SqlSelectOptions Options { get; set; } public SqlColumn[] SelectColumns { get; set; } #endregion #region Constructors internal SqlSelectProto(Sql database, SqlSelectOptions options, params SqlColumn[] columns) : base(database) { Options = options; SelectColumns = columns.Length == 0 ? null : columns; } #endregion #region Methods public SqlSelect From(SqlTable table) { if (table == null) throw new ArgumentNullException(nameof(table)); var select = new SqlSelect(Database, table); Sql.SetTableWhenUnassigned(SelectColumns, table); select.SelectColumns = SelectColumns; select.Options = Options; return select; } public SqlSelect From(SqlSelect select) { if (select == null) throw new ArgumentNullException(nameof(select)); var outerSelect = new SqlSelect(Database, select); Sql.SetTableWhenUnassigned(SelectColumns, outerSelect.Table); outerSelect.SelectColumns = SelectColumns; outerSelect.Options = Options; return outerSelect; } #endregion } public class SqlSelect : SqlQueryBase { #region Fields private readonly SqlSelect innerSelect = null; private readonly List<SqlJoin> joins = new(); private readonly List<SqlTable> joinTables = new(); public Dictionary<string, SqlColumn> filters = new(); private int limit = 0; private int offset = 0; public int LimitLength { get => limit; set { if (value >= 0) limit = value; } } public int OffsetLength { get => offset; set { if (value >= 0) offset = value; } } public SqlCondition WhereCondition { get; set; } = null; private SqlCondition innerCondition = null; internal bool after = false; public SqlOrder Order { get; set; } public SqlSelectOptions Options { get; set; } = SqlSelectOptions.None; private SqlColumn[] selectColumns = null; public SqlColumn[] SelectColumns { get { if (selectColumns != null) return selectColumns; else if (innerSelect != null && innerSelect.SelectColumns != null) { List<SqlColumn> columns = new(); foreach (var innerColumn in innerSelect.SelectColumns) columns.Add(new SqlColumn(Table, innerColumn.Ident)); return columns.ToArray(); } else return null; } set { selectColumns = value; } } private SqlSelect[] unionAlls = null; internal readonly Dictionary<string, SqlBuilder> builders = new(); private Dictionary<string, Dictionary<string, SqlBuilder>> builderCache = new(); public bool IsBuilder => builders.Count > 0 || (innerSelect != null && innerSelect.IsBuilder); public SqlSelect InnerSelect => innerSelect; #endregion #region Constructors internal SqlSelect(Sql database, SqlTable table) : base(database, table, SqlExecuteType.Reader) { } internal SqlSelect(Sql database, SqlSelect select) : base(database, new SqlTable(), SqlExecuteType.Reader) => innerSelect = select; #endregion #region Methods public SqlSelect Join(SqlJoinType type, SqlTable table, SqlCondition where) { if (!joinTables.Contains(table)) { joins.Add(new SqlJoin(type, table, where)); joinTables.Add(table); } return this; } public SqlSelect Join(SqlJoinType type, SqlTable table, SqlColumn whereColumn, object whereValue) => Join(type, table, whereColumn == whereValue); public SqlSelect Join(SqlJoinType type, SqlTable table, SqlColumn leftColumn, SqlColumn rightColumn) => Join(type, table, leftColumn == rightColumn); public SqlSelect Join(SqlTable table, SqlCondition where) => Join(SqlJoinType.Inner, table, where); public SqlSelect Join(SqlTable table, SqlColumn whereColumn, object whereValue) => Join(SqlJoinType.Inner, table, whereColumn, whereValue); public SqlSelect Join(SqlTable table, SqlColumn leftColumn, SqlColumn rightColumn) => Join(SqlJoinType.Inner, table, leftColumn, rightColumn); public SqlSelect LeftJoin(SqlTable table, SqlCondition where) => Join(SqlJoinType.Left, table, where); public SqlSelect LeftJoin(SqlTable table, SqlColumn whereColumn, object whereValue) => Join(SqlJoinType.Left, table, whereColumn, whereValue); public SqlSelect LeftJoin(SqlTable table, SqlColumn leftColumn, SqlColumn rightColumn) => Join(SqlJoinType.Left, table, leftColumn, rightColumn); public SqlSelect RightJoin(SqlTable table, SqlCondition where) => Join(SqlJoinType.Right, table, where); public SqlSelect RightJoin(SqlTable table, SqlColumn whereColumn, object whereValue) => Join(SqlJoinType.Right, table, whereColumn, whereValue); public SqlSelect RightJoin(SqlTable table, SqlColumn leftColumn, SqlColumn rightColumn) => Join(SqlJoinType.Right, table, leftColumn, rightColumn); public SqlSelect FullJoin(SqlTable table, SqlCondition where) => Join(SqlJoinType.Full, table, where); public SqlSelect FullJoin(SqlTable table, SqlColumn whereColumn, object whereValue) => Join(SqlJoinType.Full, table, whereColumn, whereValue); public SqlSelect FullJoin(SqlTable table, SqlColumn leftColumn, SqlColumn rightColumn) => Join(SqlJoinType.Full, table, leftColumn, rightColumn); public SqlSelect Where(SqlCondition condition) { WhereCondition = condition; return this; } public SqlSelect And(SqlCondition condition) { if (WhereCondition is not null) WhereCondition = WhereCondition && condition; else throw new InvalidOperationException(); return this; } public SqlSelect And(SqlColumn whereColumn, object whereValue) => And(whereColumn == whereValue); public SqlSelect Or(SqlCondition condition) { if (WhereCondition is not null) WhereCondition = WhereCondition || condition; else throw new InvalidOperationException(); return this; } public SqlSelect Or(SqlColumn whereColumn, object whereValue) => Or(whereColumn == whereValue); public SqlSelect Where(SqlColumn whereColumn, object whereValue) => Where(whereColumn == whereValue); public SqlSelect OrderBy(SqlColumn column, Order order) { Order = SqlOrder.By(column, order); return this; } public SqlSelect OrderBy(params (SqlColumn, Order)[] args) { var order = new SqlOrder(); foreach (var (col, ord) in args) { order.Add(col, ord); } Order = order; return this; } public SqlSelect Limit(int limit, int offset) { LimitLength = limit; OffsetLength = offset; return this; } public SqlSelect Limit(int limit) => Limit(limit, 0); public SqlSelect UnionAll(params SqlSelect[] selects) { // should match with SelectColumns var sc = SelectColumns.Format(o => o.Length, 0); foreach (var select in selects) { var ssc = select.SelectColumns.Format(o => o.Length, 0); if (ssc != sc) throw new InvalidOperationException("SelectColumns should match with main SqlSelect"); } unionAlls = selects; // make builder keys same for every select in unionAlls List<string> names = new(); // get available keys from this and all unions foreach (var (name, _) in builders) { names.Add(name); } foreach (var select in unionAlls) { foreach (var (name, _) in select.builders) { if (!names.Contains(name)) names.Add(name); } } // add missing keys to this and all unions var names1 = builders.Keys.ToArray(); foreach (var name in names) { if (!names1.Contains(name)) { builders.Add(name, new SqlBuilder());// (SqlColumn.Null, SqlBuilderOptions.None, null, null, null, null, null)); } } foreach (var select in unionAlls) { var names2 = select.builders.Keys.ToArray(); foreach (var name in names) { if (!names2.Contains(name)) { select.builders.Add(name, new SqlBuilder()); } } } // create a new encapsulating select for these mfs return Database.Select().From(this); } private SqlTable GetTableStatement(Values<string> selectBuilders) { if (innerSelect != null) { var statement = new StringBuilder(); statement.AppendLine(innerSelect.GetStatements(selectBuilders)[0].Trim()); var unionAlls = innerSelect.unionAlls; if (unionAlls != null) { foreach (var s in unionAlls) { var dx = s.GetStatements(selectBuilders)[0].Trim(); statement.AppendLine("union all"); statement.AppendLine(dx); } } return Table.GetStatement(statement.ToString()); } else return Table; } /// <summary> /// Prepares /// </summary> /// <typeparam name="T">Target object when queried.</typeparam> /// <param name="add">Add new property</param> public void Builder<T>(Action<SqlBuilderAdd<T>> add) where T : class { if (IsBuilder) throw new InvalidOperationException("Builder has already been created for this instance"); add((name, column, formatter, binder, select, query, requires, ext) => { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); if (column is null) throw new ArgumentNullException(nameof(column)); if (builders.ContainsKey(name)) throw new InvalidOperationException($"Builder with {name} option has already added."); builders.Add(name, new SqlBuilder { Name = name, Column = column, Formatter = formatter != null ? values => formatter.Invoke(new SqlBuilderFormatter { Name = name, Values = values }) : null, Binder = binder != null ? (obj, values, formattedValues) => binder.Invoke(obj as T, new SqlBuilderBinder { Name = name, Values = values, FormattedValues = formattedValues }) : null, Select = select, Query = query, Requires = requires, Ext = ext != null ? o => ext(o as T) : null }); }); } /// <summary> /// Remove builders. /// </summary> /// public void RemoveBuilder() => builders.Clear(); /// <summary> /// Get builder list by name. /// </summary> public Dictionary<string, SqlBuilder> GetBuilderStack(string name) { if (builderCache.ContainsKey(name)) return builderCache[name]; else { Dictionary<string, SqlBuilder> v = null; if (innerSelect != null) { if (innerSelect.builders.ContainsKey(name)) { v = new(); v.Add(innerSelect.Table.Alias, innerSelect.builders[name]); if (innerSelect.unionAlls != null) { foreach (var unionSelect in innerSelect.unionAlls) { v.Add(unionSelect.Table.Alias, unionSelect.builders[name]); } } } } if (v == null && builders.ContainsKey(name)) { v = new(); v.Add("___default", builders[name]); } builderCache.Add(name, v); return v; } } /// <summary> /// Get builder list by stack name. /// </summary> public Dictionary<string, SqlBuilder> GetBuildersByStack(string stack) { if (stack == null || stack == "___default") return builders; else if (innerSelect != null) { if (innerSelect.Table.Alias == stack) return innerSelect.builders; else if (innerSelect.unionAlls != null) { foreach (var unionSelect in innerSelect.unionAlls) { if (unionSelect.Table.Alias == stack) return unionSelect.builders; } } } return null; } /// <summary> /// Get builder by name for current row. /// </summary> public SqlBuilder GetBuilder(string name, SqlRow row) { var builderStack = GetBuilderStack(name); if (builderStack != null && builderStack.Count > 0) { if (row != null && row.ContainsKey("___select")) { var selectId = row["___select"].GetString(); if (selectId != null) { if (builderStack.ContainsKey(selectId)) return builderStack[selectId]; } } return builderStack.Get(0).Item2; } return null; } /// <summary> /// Prepares select for query. /// </summary> public void BuilderQuery(Dictionary<string, (SqlQueryType, string)[]> queries) { if (!IsBuilder) throw new InvalidOperationException("This select instance is not in builder mode."); Dictionary<string, SqlCondition> stackConditions = new(); // field1 => state1, state2, field2 => state1, state2 foreach (var (name, states) in queries) { var builderStack = GetBuilderStack(name); // select1, select2 foreach (var (stack, builder) in builderStack) { SqlCondition condition = stackConditions.ContainsKey(stack) ? stackConditions[stack] : null; SqlCondition sumCondition = null; SqlColumn column = builder.Column; Dictionary<string, SqlColumn> columns = new(); var stackBuilders = GetBuildersByStack(stack); if (stackBuilders != null) { foreach (var (stackBuilderName, stackBuilder) in stackBuilders) { columns.Add(stackBuilderName, stackBuilder.Column); } } foreach (var (type, query) in states) { SqlCondition stateCondition = null; if (builder.Query == null) { if (type == SqlQueryType.Equal) stateCondition = column == query; } else { stateCondition = builder.Query(new SqlQueryColumn(column, columns, type, query)); } sumCondition = sumCondition && stateCondition; } condition = condition && sumCondition; if (stackConditions.ContainsKey(stack)) stackConditions.Add(stack, condition); else stackConditions[stack] = condition; } } foreach (var (stack, condition) in stackConditions) { if (Table.Alias == stack) { WhereCondition = condition && WhereCondition; } else if (innerSelect != null && innerSelect.Table.Alias == stack) { innerSelect.WhereCondition = condition && innerSelect.WhereCondition; } else if (innerSelect.unionAlls != null) { foreach (var unionAll in innerSelect.unionAlls) { if (unionAll.Table.Alias == stack) { unionAll.WhereCondition = condition && unionAll.WhereCondition; break; } } } } } private void Extend(List<string> extSelectBuilders, string name) { if (!extSelectBuilders.Contains(name)) { extSelectBuilders.Add(name); var builderStack = GetBuilderStack(name); if (builderStack != null) { foreach (var (_, builder) in builderStack) { if (builder != null && builder.Requires != null) { foreach (var require in builder.Requires) { Extend(extSelectBuilders, require); } } } } } } protected override string[] GetStatements(Values<string> selectBuilders) { // extend selectBuilders if (selectBuilders != null) { List<string> extSelectBuilders = new(); foreach (string name in selectBuilders) { Extend(extSelectBuilders, name); } selectBuilders = extSelectBuilders.ToArray(); } // Get columns from my builder var builderColumns = new List<SqlColumn>(); if (selectBuilders != null) { if (innerSelect != null) { builderColumns.Add(new SqlColumn(Table, "___select")); // only get columns foreach (var param in selectBuilders) { foreach (var (name, _) in innerSelect.builders) { if (param == name) builderColumns.Add(new SqlColumn(Table, name)); } } } else if (builders.Count > 0) { builderColumns.Add(SqlColumn.Static(Table.Alias, "___select")); foreach (var param in selectBuilders) { foreach (var (name, builder) in builders) { if (param == name) { var column = builder.Column; var selectColumn = new SqlColumn(column.Table, column.Name, name); if (column.IsValue) { selectColumn.IsValue = true; selectColumn.Value = column.Value; } builderColumns.Add(selectColumn); builder.Select?.Invoke(this); } } } } } // Combine predefined columns with builder columns var allColumnsList = new List<SqlColumn>(); if (SelectColumns != null) allColumnsList.AddRange(SelectColumns); allColumnsList.AddRange(builderColumns); var allColumns = allColumnsList.ToArray(); // Assign columns to table if (Table != null) Sql.SetTableWhenUnassigned(allColumns, Table); return Database.Connection.FormatSelect( GetTableStatement(selectBuilders), allColumns, joins.ToArray(), innerCondition && WhereCondition, Order, limit, offset, Options) .Array(); } public int ExecuteCount(Values<string> selectBuilders) => ExecuteCount(selectBuilders, out _); public int ExecuteCount(Values<string> selectBuilders, out SqlQuery sqlQuery) { var dd = Database.Connection.FormatSelect( GetTableStatement(selectBuilders), new SqlColumn[] { "COUNT(*)" }, joins.ToArray(), WhereCondition, null, 0, 0, Options); sqlQuery = Execute(dd); if (sqlQuery) { var rci = ((SqlCell)sqlQuery).GetInt(); return rci; } return 0; } #region API internal void SetInnerCondition(SqlCondition conditon) => innerCondition = conditon; internal SqlColumn GetFilterColumn(string name) => filters.ContainsKey(name) ? filters[name] : null; public void Filter<T>(PropFilter<T> filter, string name) { } public void Filter<T>(PropFilter<T> filter, SqlColumn column) => Filter(filter, column, (Func<object, object>)null); public void Filter<T>(PropFilter<T> filter, SqlColumn column, Func<object, object> modifier) => Filter(filter, column, new Dictionary<string, Func<object, object>> { { "___default", modifier } }); public void Filter<T>(PropFilter<T> filter, SqlColumn column, Dictionary<string, Func<object, object>> modifiers) { if (filter == null) throw new ArgumentNullException(nameof(filter)); if (column == null) throw new ArgumentNullException(nameof(column)); if (modifiers == null) throw new ArgumentNullException(nameof(modifiers)); filters.Add(filter.Name, column); if (filter.Values != null) { foreach (var (attribute, filterValue) in filter.Values) { SqlCondition sumCondition = null; object value; T castValue = filterValue.Cast<T>(); foreach (var (name, modifier) in modifiers) { if (modifier != null) value = modifier(castValue); else value = castValue; if (value is not null) { SqlCondition newCondition = null; if (value is DataObject obj) { if (obj.Data == "NULL") newCondition = column == null; else if (obj.Data == "NOTNULL") newCondition = column != null; else if (obj.Data == "CANCEL") newCondition = new SqlCondition(false); } else { var isNumeric = value.IsNumeric(); if (attribute == null) newCondition = column == value; else if (attribute == "like") newCondition = column % $"%{value}%"; else if (attribute == "start") newCondition = column % $"{value}%"; else if (attribute == "end") newCondition = column % $"%{value}"; else if (attribute == "notlike") newCondition = column ^ $"%{value}%"; else if (attribute == "not") newCondition = column != value; else if (isNumeric && attribute == "lt") newCondition = column < value; else if (isNumeric && attribute == "gt") newCondition = column > value; else if (isNumeric && attribute == "lte") newCondition = column <= value; else if (isNumeric && attribute == "gte") newCondition = column >= value; else newCondition = column == value; } if (name != "___default") newCondition = newCondition && Table["___select"] == name; if (sumCondition is null) sumCondition = newCondition; else sumCondition = sumCondition || newCondition; } } WhereCondition = sumCondition && WhereCondition; } } } #endregion #endregion #region Statics public static SqlSelect UnionAlls(params SqlSelect[] selects) { if (selects.Length >= 2) return selects[0].UnionAll(selects[1..]); else if (selects.Length == 1) return selects[0]; else return null; } #endregion } public sealed class SqlBuilder { #region Fields public string Name { get; init; } public SqlColumn Column { get; init; } = SqlColumn.Null; public Func<Dictionary<string, SqlCell>, object> Formatter { get; init; } public Action<object, Dictionary<string, SqlCell>, Dictionary<string, object>> Binder { get; init; } public Action<SqlSelect> Select { get; init; } public Func<SqlQueryColumn, SqlCondition> Query { get; init; } public Values<string> Requires { get; init; } public Func<object, object> Ext { get; init; } #endregion } public delegate void SqlBuilderAdd<T>( string name, SqlColumn column, Func<SqlBuilderFormatter, object> formatter = null, Action<T, SqlBuilderBinder> binder = null, Action<SqlSelect> select = null, Func<SqlQueryColumn, SqlCondition> query = null, Values<string> requires = null, Func<T, object> ext = null ); public class SqlBuilderFormatter { public string Name { get; init; } public Dictionary<string, SqlCell> Values { get; init; } public SqlCell Value => Values.ContainsKey(Name) ? Values[Name] : null; } public class SqlBuilderBinder : SqlBuilderFormatter { public Dictionary<string, object> FormattedValues { get; init; } public object FormattedValue => Values.ContainsKey(Name) ? FormattedValues[Name] : null; } public sealed class SqlQueryColumn : SqlColumn { private Dictionary<string, SqlColumn> builderColumns; public SqlQueryType Type { get; } public string Query { get; } public SqlColumn this[string name] => builderColumns[name]; internal SqlQueryColumn(SqlColumn main, Dictionary<string, SqlColumn> builderColumns, SqlQueryType type, string query) : base(main.Table, main.Name, main.Alias) { this.builderColumns = builderColumns; Type = type; Query = query; } } [Flags] public enum SqlSelectOptions { None = 0, Distinct = 1, Random = 2 } public enum SqlDataType { Numeric, String } public enum SqlQueryType { None, Equal, NotEqual, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, StartsWith, EndsWith, Like, NotLike }
30.878515
200
0.542712
[ "MIT" ]
4vz/Aveezo
Aveezo/Data/Sql/Query/SqlSelect.cs
27,453
C#
//////////////////////////////////////////////////////////////////////////////// //NUnit tests for "EF Core Provider for LCPI OLE DB" // IBProvider and Contributors. 02.05.2021. using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Microsoft.EntityFrameworkCore; using NUnit.Framework; using xdb=lcpi.data.oledb; namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D1.Query.Operators.SET_001.LessThanOrEqual.Complete.NullableInt32.NullableSingle{ //////////////////////////////////////////////////////////////////////////////// using T_DATA1 =System.Nullable<System.Int32>; using T_DATA2 =System.Nullable<System.Single>; using T_DATA1_U=System.Int32; using T_DATA2_U=System.Single; //////////////////////////////////////////////////////////////////////////////// //class TestSet_001__fields__03__NV public static class TestSet_001__fields__03__NV { private const string c_NameOf__TABLE ="TEST_MODIFY_ROW2"; private const string c_NameOf__COL_DATA1 ="COL_INTEGER"; private const string c_NameOf__COL_DATA2 ="COL2_FLOAT"; private sealed class MyContext:TestBaseDbContext { [Table(c_NameOf__TABLE)] public sealed class TEST_RECORD { [Key] [Column("TEST_ID")] public System.Int64? TEST_ID { get; set; } [Column(c_NameOf__COL_DATA1)] public T_DATA1 COL_DATA1 { get; set; } [Column(c_NameOf__COL_DATA2)] public T_DATA2 COL_DATA2 { get; set; } };//class TEST_RECORD //---------------------------------------------------------------------- public DbSet<TEST_RECORD> testTable { get; set; } //---------------------------------------------------------------------- public MyContext(xdb.OleDbTransaction tr) :base(tr) { }//MyContext };//class MyContext //----------------------------------------------------------------------- [Test] public static void Test_001() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { const T_DATA2_U c_value2=4; System.Int64? testID=Helper__InsertRow(db,null,c_value2); var recs=db.testTable.Where(r => (r.COL_DATA1 /*OP{*/ <= /*}OP*/ r.COL_DATA2) && r.TEST_ID==testID); foreach(var r in recs) { TestServices.ThrowSelectedRow(); }//foreach r db.CheckTextOfLastExecutedCommand (new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE (").N_AS_FLT("t",c_NameOf__COL_DATA1).T(" <= ").N("t",c_NameOf__COL_DATA2).T(") AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")")); }//using db tr.Rollback(); }//using tr }//using cn }//Test_001 //----------------------------------------------------------------------- [Test] public static void Test_002() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { const T_DATA2_U c_value2=4; System.Int64? testID=Helper__InsertRow(db,null,c_value2); var recs=db.testTable.Where(r => !(r.COL_DATA1 /*OP{*/ <= /*}OP*/ r.COL_DATA2) && r.TEST_ID==testID); foreach(var r in recs) { TestServices.ThrowSelectedRow(); }//foreach r db.CheckTextOfLastExecutedCommand (new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE NOT (").N_AS_FLT("t",c_NameOf__COL_DATA1).T(" <= ").N("t",c_NameOf__COL_DATA2).T(") AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")")); }//using db tr.Rollback(); }//using tr }//using cn }//Test_002 //Helper methods -------------------------------------------------------- private static System.Int64 Helper__InsertRow(MyContext db, T_DATA1 valueForColData1, T_DATA2 valueForColData2) { var newRecord=new MyContext.TEST_RECORD(); newRecord.COL_DATA1 =valueForColData1; newRecord.COL_DATA2 =valueForColData2; db.testTable.Add(newRecord); db.SaveChanges(); db.CheckTextOfLastExecutedCommand (new TestSqlTemplate() .T("INSERT INTO ").N(c_NameOf__TABLE).T(" (").N(c_NameOf__COL_DATA1).T(", ").N(c_NameOf__COL_DATA2).T(")").EOL() .T("VALUES (").P("p0").T(", ").P("p1").T(")").EOL() .T("RETURNING ").N("TEST_ID").EOL() .T("INTO ").P("p2").T(";")); Assert.IsTrue (newRecord.TEST_ID.HasValue); Console.WriteLine("TEST_ID: {0}",newRecord.TEST_ID.Value); return newRecord.TEST_ID.Value; }//Helper__InsertRow };//class TestSet_001__fields__03__NV //////////////////////////////////////////////////////////////////////////////// }//namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D1.Query.Operators.SET_001.LessThanOrEqual.Complete.NullableInt32.NullableSingle
32.807453
163
0.57251
[ "MIT" ]
ibprovider/Lcpi.EFCore.LcpiOleDb
Tests/General/Source/Work/DBMS/Firebird/V03_0_0/D1/Query/Operators/SET_001/LessThanOrEqual/Complete/NullableInt32/NullableSingle/TestSet_001__fields__03__NV.cs
5,284
C#
using System; namespace Animals { public class StartUp { public static void Main(string[] args) { Animal cat = new Cat("Pesho", "Whiskas"); Animal dog = new Dog("Gosho", "Meat"); Console.WriteLine(cat.ExplainSelf()); Console.WriteLine(dog.ExplainSelf()); } } }
19.388889
53
0.532951
[ "MIT" ]
MirelaMileva/C-Sharp-OOP
Polymorphism/Animals/StartUp.cs
351
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Consul; using Orleans.Messaging; using Orleans.Runtime.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OrleansConsulUtils.Options; namespace Orleans.Runtime.Membership { public class ConsulGatewayListProvider : IGatewayListProvider { private ConsulClient consulClient; private string deploymentId; private ILogger logger; private readonly ConsulGatewayListProviderOptions options; private readonly TimeSpan maxStaleness; public ConsulGatewayListProvider(ILogger<ConsulGatewayListProvider> logger, ClientConfiguration clientConfig, IOptions<ConsulGatewayListProviderOptions> options) { this.logger = logger; this.deploymentId = clientConfig.DeploymentId; this.maxStaleness = clientConfig.GatewayListRefreshPeriod; this.options = options.Value; } public TimeSpan MaxStaleness { get { return this.maxStaleness; } } public Boolean IsUpdatable { get { return true; } } public Task InitializeGatewayListProvider() { consulClient = new ConsulClient(config => config.Address = options.Address); return Task.CompletedTask; } public async Task<IList<Uri>> GetGateways() { var membershipTableData = await ConsulBasedMembershipTable.ReadAll(this.consulClient, this.deploymentId, this.logger); if (membershipTableData == null) return new List<Uri>(); return membershipTableData.Members.Select(e => e.Item1). Where(m => m.Status == SiloStatus.Active && m.ProxyPort != 0). Select(m => { m.SiloAddress.Endpoint.Port = m.ProxyPort; return m.SiloAddress.ToGatewayUri(); }).ToList(); } } }
32.571429
169
0.641813
[ "MIT" ]
seralexeev/orleans
src/Orleans.Membership.Consul/ConsulGatewayListProvider.cs
2,054
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.OperationalInsights.Models { using Microsoft.Rest; using Microsoft.Rest.Azure; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; /// <summary> /// Defines a page in Azure responses. /// </summary> /// <typeparam name="T">Type of the page content items</typeparam> [JsonObject] public class Page1<T> : IPage<T> { /// <summary> /// Gets the link to the next page. /// </summary> [JsonProperty("")] public string NextPageLink { get; private set; } [JsonProperty("value")] private IList<T> Items{ get; set; } /// <summary> /// Returns an enumerator that iterates through the collection. /// </summary> /// <returns>A an enumerator that can be used to iterate through the collection.</returns> public IEnumerator<T> GetEnumerator() { return Items == null ? System.Linq.Enumerable.Empty<T>().GetEnumerator() : Items.GetEnumerator(); } /// <summary> /// Returns an enumerator that iterates through the collection. /// </summary> /// <returns>A an enumerator that can be used to iterate through the collection.</returns> IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } }
32.962963
111
0.62191
[ "MIT" ]
AikoBB/azure-sdk-for-net
sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/Models/Page1.cs
1,780
C#
using MediatR; using System; using System.Net.Http; using System.Threading.Tasks; using System.Web.Http; using System.Web.Http.Description; using NoDaysOffApp.Features.Core; namespace NoDaysOffApp.Features.Athletes { [Authorize] [RoutePrefix("api/athletes")] public class AthleteController : BaseApiController { public AthleteController(IMediator mediator) :base(mediator) { } [Route("add")] [HttpPost] [ResponseType(typeof(AddOrUpdateAthleteCommand.Response))] public async Task<IHttpActionResult> Add(AddOrUpdateAthleteCommand.Request request) => Ok(await Send(request)); [Route("update")] [HttpPut] [ResponseType(typeof(AddOrUpdateAthleteCommand.Response))] public async Task<IHttpActionResult> Update(AddOrUpdateAthleteCommand.Request request) => Ok(await Send(request)); [Route("get")] [HttpGet] [ResponseType(typeof(GetAthletesQuery.Response))] public async Task<IHttpActionResult> Get() => Ok(await Send(new GetAthletesQuery.Request())); [Route("getcurrent")] [HttpGet] [ResponseType(typeof(GetCurrentAthleteQuery.Response))] public async Task<IHttpActionResult> GetCurrent() => Ok(await Send(new GetCurrentAthleteQuery.Request())); [Route("getById")] [HttpGet] [ResponseType(typeof(GetAthleteByIdQuery.Response))] public async Task<IHttpActionResult> GetById([FromUri]GetAthleteByIdQuery.Request request) => Ok(await Send(request)); [Route("remove")] [HttpDelete] [ResponseType(typeof(RemoveAthleteCommand.Response))] public async Task<IHttpActionResult> Remove([FromUri]RemoveAthleteCommand.Request request) => Ok(await Send(request)); } }
35.94
126
0.689482
[ "MIT" ]
QuinntyneBrown/no-days-off-app
Features/Athletes/AthletesController.cs
1,797
C#
using System; using System.Collections.Generic; using Xunit.Sdk; namespace Xunit { public partial class Assert { /// <summary> /// Verifies that a value is within a given range. /// </summary> /// <typeparam name="T">The type of the value to be compared</typeparam> /// <param name="actual">The actual value to be evaluated</param> /// <param name="low">The (inclusive) low value of the range</param> /// <param name="high">The (inclusive) high value of the range</param> /// <exception cref="InRangeException">Thrown when the value is not in the given range</exception> public static void InRange<T>(T actual, T low, T high) where T : IComparable { InRange(actual, low, high, GetComparer<T>()); } /// <summary> /// Verifies that a value is within a given range, using a comparer. /// </summary> /// <typeparam name="T">The type of the value to be compared</typeparam> /// <param name="actual">The actual value to be evaluated</param> /// <param name="low">The (inclusive) low value of the range</param> /// <param name="high">The (inclusive) high value of the range</param> /// <param name="comparer">The comparer used to evaluate the value's range</param> /// <exception cref="InRangeException">Thrown when the value is not in the given range</exception> public static void InRange<T>(T actual, T low, T high, IComparer<T> comparer) { Assert.GuardArgumentNotNull("comparer", comparer); if (comparer.Compare(low, actual) > 0 || comparer.Compare(actual, high) > 0) throw new InRangeException(actual, low, high); } /// <summary> /// Verifies that a value is not within a given range, using the default comparer. /// </summary> /// <typeparam name="T">The type of the value to be compared</typeparam> /// <param name="actual">The actual value to be evaluated</param> /// <param name="low">The (inclusive) low value of the range</param> /// <param name="high">The (inclusive) high value of the range</param> /// <exception cref="NotInRangeException">Thrown when the value is in the given range</exception> public static void NotInRange<T>(T actual, T low, T high) where T : IComparable { NotInRange(actual, low, high, GetComparer<T>()); } /// <summary> /// Verifies that a value is not within a given range, using a comparer. /// </summary> /// <typeparam name="T">The type of the value to be compared</typeparam> /// <param name="actual">The actual value to be evaluated</param> /// <param name="low">The (inclusive) low value of the range</param> /// <param name="high">The (inclusive) high value of the range</param> /// <param name="comparer">The comparer used to evaluate the value's range</param> /// <exception cref="NotInRangeException">Thrown when the value is in the given range</exception> public static void NotInRange<T>(T actual, T low, T high, IComparer<T> comparer) { Assert.GuardArgumentNotNull("comparer", comparer); if (comparer.Compare(low, actual) <= 0 && comparer.Compare(actual, high) <= 0) throw new NotInRangeException(actual, low, high); } } }
44.84058
100
0.687783
[ "Apache-2.0" ]
cuteant/xUnit4NetFX40
xunit.assert/Asserts/RangeAsserts.cs
3,096
C#
// Copyright (c) Peter Vrenken. All rights reserved. See the license on https://github.com/vrenken/EtAlii.Ubigia namespace EtAlii.Ubigia.Api.Functional.Traversal { using Moppet.Lapa; internal class ParentPathSubjectPartParser : IParentPathSubjectPartParser { public string Id => nameof(ParentPathSubjectPart); public LpsParser Parser { get; } private readonly INodeValidator _nodeValidator; private const string RelationId = @"/"; private const string RelationDescription = @"PARENT_OF"; public ParentPathSubjectPartParser( INodeValidator nodeValidator, IPathRelationParserBuilder pathRelationParserBuilder) { _nodeValidator = nodeValidator; var relationParser = pathRelationParserBuilder.CreatePathRelationParser(RelationDescription, RelationId); Parser = new LpsParser(Id, true, relationParser);//.Debug("IsParentOfPathSubjectParser") } public PathSubjectPart Parse(LpNode node) { _nodeValidator.EnsureSuccess(node, Id); return new ParentPathSubjectPart(); } public bool CanParse(LpNode node) { return node.Id == Id; } } }
31.475
117
0.666402
[ "MIT" ]
vrenken/EtAlii.Ubigia
Source/Api/EtAlii.Ubigia.Api.Functional.Lapa/Traversal/1. Parsing/Subjects/Paths/Parts/Hierarchical/ParentPathSubjectPartParser.cs
1,261
C#
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace UsbDetectorWpf { class Converter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return null; //throw new NotImplementedException(); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
24.88
103
0.680064
[ "MIT" ]
dtwk1/UsbDetectorWpf
UsbDetectorWpf/Converter.cs
624
C#
// WARNING // // This file has been generated automatically by Visual Studio from the outlets and // actions declared in your storyboard file. // Manual changes to this file will not be maintained. // using Foundation; using System; using System.CodeDom.Compiler; namespace UICatalog { [Register ("SwitchesViewController")] partial class SwitchesViewController { [Outlet] UIKit.UISwitch defaultSwitch { get; set; } [Outlet] UIKit.UISwitch tintedSwitch { get; set; } [Action ("DefaultSwittcherValueChanged:")] partial void DefaultSwittcherValueChanged (Foundation.NSObject sender); [Action ("DefaultValueChanged:")] partial void DefaultValueChanged (Foundation.NSObject sender); [Action ("TintedValueChanged:")] partial void TintedValueChanged (Foundation.NSObject sender); void ReleaseDesignerOutlets () { if (defaultSwitch != null) { defaultSwitch.Dispose (); defaultSwitch = null; } if (tintedSwitch != null) { tintedSwitch.Dispose (); tintedSwitch = null; } } } }
26.166667
84
0.596338
[ "MIT" ]
Art-Lav/ios-samples
UICatalog/UICatalog/Controllers/SwitchesViewController.designer.cs
1,256
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; namespace Tool.DropDaemon { /// <summary> /// Drop configuration. /// </summary> public sealed class DropConfig { #region ConfigOptions /// <summary> /// Drop name. /// </summary> public string Name { get; } /// <summary> /// Drop service to connect to. /// </summary> public Uri Service { get; } /// <summary> /// Size of batches in which to send 'associate' requests to drop service endpoint. /// </summary> public int BatchSize = DefaultBatchSizeForAssociate; /// <summary> /// Maximum number of uploads to issue to drop service endpoint in parallel. /// </summary> public int MaxParallelUploads { get; } /// <summary> /// Maximum time in milliseconds to wait before triggering a batch 'associate' request. /// </summary> public TimeSpan NagleTime = DefaultNagleTimeForAssociate; /// <summary> /// Used to compute drop expiration date (<see cref="Microsoft.VisualStudio.Services.Drop.App.Core.IDropServiceClient.CreateAsync(string, bool, DateTime?, bool, System.Threading.CancellationToken)"/>). /// </summary> public TimeSpan Retention { get; } /// <summary> /// Timeout for http requests (<see cref="Microsoft.VisualStudio.Services.Content.Common.ArtifactHttpClientFactory.ArtifactHttpClientFactory(Microsoft.VisualStudio.Services.Common.VssCredentials, TimeSpan?, Microsoft.VisualStudio.Services.Content.Common.Tracing.IAppTraceSource, System.Threading.CancellationToken)"/>). /// </summary> public TimeSpan HttpSendTimeout { get; } /// <summary> /// Enable verbose logging. /// </summary> public bool Verbose { get; } /// <summary> /// Enable drop telemetry. /// </summary> public bool EnableTelemetry { get; } /// <summary> /// Enable chunk dedup. /// </summary> public bool EnableChunkDedup { get; } /// <summary> /// Log directory. /// </summary> public string LogDir { get; } /// <summary> /// File name for artifact-side logs /// </summary> public string ArtifactLogName { get; } /// <summary> /// Optional domain id. Null represents a default value. /// </summary> public byte? DomainId { get; } /// <summary> /// Build Manifest generation flag. /// </summary> public bool GenerateBuildManifest { get; } /// <summary> /// Build Manifest Signing flag. /// </summary> public bool SignBuildManifest { get; } /// <summary> /// Repo path of the code being build /// </summary> public string Repo { get; } /// <summary> /// Current Git branch within the specified <see cref="Repo"/> /// </summary> public string Branch { get; } /// <summary> /// Current Git CommitId within the specified <see cref="Repo"/> /// </summary> public string CommitId { get; } /// <summary> /// Represents the RelativeActivityId specific to the cloud build environment /// </summary> public string CloudBuildId { get; } /// <summary> /// Represents the BuildSessionInfo: bsi.json file path. /// </summary> public string BsiFileLocation { get; } /// <summary> /// Represents the Path to makecat.exe for Build Manifest Catalog generation. /// </summary> public string MakeCatToolPath { get; } /// <summary> /// Represents the Path to EsrpManifestSign.exe for Build Manifest Catalog Signing. /// </summary> public string EsrpManifestSignToolPath { get; } #endregion #region Defaults /// <nodoc/> public static Uri DefaultServiceEndpoint { get; } = new Uri("https://artifactsu0.artifacts.visualstudio.com/DefaultCollection"); /// <nodoc/> public const int DefaultBatchSizeForAssociate = 300; /// <nodoc/> public static int DefaultMaxParallelUploads { get; } = Environment.ProcessorCount; /// <nodoc/> public static readonly TimeSpan DefaultNagleTimeForAssociate = TimeSpan.FromMilliseconds(300); /// <nodoc/> public static TimeSpan DefaultRetention { get; } = TimeSpan.FromDays(10); /// <nodoc/> public static TimeSpan DefaultHttpSendTimeout { get; } = TimeSpan.FromMinutes(10); /// <nodoc/> public static bool DefaultVerbose { get; } = false; /// <nodoc/> public static bool DefaultEnableTelemetry { get; } = false; /// <nodoc/> public static bool DefaultEnableChunkDedup { get; } = false; /// <nodoc/> public static bool DefaultGenerateBuildManifest { get; } = false; /// <nodoc/> public static bool DefaultSignBuildManifest { get; } = false; #endregion // ================================================================================================== // Constructor // ================================================================================================== /// <nodoc/> public DropConfig( string dropName, Uri serviceEndpoint, int? maxParallelUploads = null, TimeSpan? retention = null, TimeSpan? httpSendTimeout = null, bool? verbose = null, bool? enableTelemetry = null, bool? enableChunkDedup = null, string logDir = null, string artifactLogName = null, int? batchSize = null, byte? dropDomainId = null, bool? generateBuildManifest = null, bool? signBuildManifest = null, string repo = null, string branch = null, string commitId = null, string cloudBuildId = null, string bsiFileLocation = null, string makeCatToolPath = null, string esrpManifestSignToolPath = null) { Name = dropName; Service = serviceEndpoint; MaxParallelUploads = maxParallelUploads ?? DefaultMaxParallelUploads; Retention = retention ?? DefaultRetention; HttpSendTimeout = httpSendTimeout ?? DefaultHttpSendTimeout; Verbose = verbose ?? DefaultVerbose; EnableTelemetry = enableTelemetry ?? DefaultEnableTelemetry; EnableChunkDedup = enableChunkDedup ?? DefaultEnableChunkDedup; LogDir = logDir; ArtifactLogName = artifactLogName; BatchSize = batchSize ?? DefaultBatchSizeForAssociate; DomainId = dropDomainId; GenerateBuildManifest = generateBuildManifest ?? DefaultGenerateBuildManifest; SignBuildManifest = signBuildManifest ?? DefaultSignBuildManifest; Repo = repo ?? string.Empty; Branch = branch ?? string.Empty; CommitId = commitId ?? string.Empty; CloudBuildId = cloudBuildId ?? string.Empty; BsiFileLocation = bsiFileLocation ?? string.Empty; MakeCatToolPath = makeCatToolPath ?? string.Empty; EsrpManifestSignToolPath = esrpManifestSignToolPath ?? string.Empty; } } }
36.813084
332
0.548997
[ "MIT" ]
Pooffick/BuildXL
Public/Src/Tools/DropDaemon/DropConfig.cs
7,878
C#
namespace HoneybeeSchema.Radiance { public partial interface IBuildingModifierSet: IModifierset{} } //Classes implemented this interface: namespace HoneybeeSchema { public partial class ModifierSet: HoneybeeSchema.Radiance.IBuildingModifierSet { } public partial class ModifierSetAbridged : HoneybeeSchema.Radiance.IBuildingModifierSet { } }
26.846154
92
0.82808
[ "MIT" ]
MingboPeng/honeybee-schema-dotnet
src/HoneybeeSchema/ManualAdded/Interface/IBuildingConstructionset_Manual.cs
349
C#