| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 3 | | // license information. |
| | 4 | |
|
| | 5 | | using System; |
| | 6 | | using Microsoft.Azure.Search.Common; |
| | 7 | | using Microsoft.Azure.Search.Serialization; |
| | 8 | | using Newtonsoft.Json; |
| | 9 | |
|
| | 10 | | namespace Microsoft.Azure.Search.Models |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Defines which parts of a blob will be indexed by the blob storage indexer. |
| | 14 | | /// <see href="https://docs.microsoft.com/azure/search/search-howto-indexing-azure-blob-storage" /> |
| | 15 | | /// </summary> |
| | 16 | | [JsonConverter(typeof(ExtensibleEnumConverter<BlobExtractionMode>))] |
| | 17 | | public struct BlobExtractionMode : IEquatable<BlobExtractionMode> |
| | 18 | | { |
| | 19 | | private readonly string _value; |
| | 20 | |
|
| | 21 | | /// <summary> |
| | 22 | | /// Specifies that only the standard blob properties and user-specified metadata will be indexed. |
| | 23 | | /// For more information, see <see href="https://docs.microsoft.com/azure/storage/blobs/storage-blob-container-p |
| | 24 | | /// </summary> |
| 2 | 25 | | public static readonly BlobExtractionMode StorageMetadata = new BlobExtractionMode("storageMetadata"); |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// Specifies that storage metadata and the content-type specific metadata extracted from the blob content will |
| | 29 | | /// For more information, see <see href="https://docs.microsoft.com/azure/search/search-howto-indexing-azure-blo |
| | 30 | | /// </summary> |
| 2 | 31 | | public static readonly BlobExtractionMode AllMetadata = new BlobExtractionMode("allMetadata"); |
| | 32 | |
|
| | 33 | | /// <summary> |
| | 34 | | /// Specifies that all metadata and textual content extracted from the blob will be indexed. This is the default |
| | 35 | | /// For more information, see <see href="https://docs.microsoft.com/azure/search/search-howto-indexing-azure-blo |
| | 36 | | /// </summary> |
| 2 | 37 | | public static readonly BlobExtractionMode ContentAndMetadata = new BlobExtractionMode("contentAndMetadata"); |
| | 38 | |
|
| | 39 | | private BlobExtractionMode(string mode) |
| | 40 | | { |
| 6 | 41 | | Throw.IfArgumentNull(mode, nameof(mode)); |
| 6 | 42 | | _value = mode; |
| 6 | 43 | | } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Defines implicit conversion from string to BlobExtractionMode. |
| | 47 | | /// </summary> |
| | 48 | | /// <param name="value">string to convert.</param> |
| | 49 | | /// <returns>The string as a BlobExtractionMode.</returns> |
| 0 | 50 | | public static implicit operator BlobExtractionMode(string value) => new BlobExtractionMode(value); |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// Defines explicit conversion from BlobExtractionMode to string. |
| | 54 | | /// </summary> |
| | 55 | | /// <param name="mode">BlobExtractionMode to convert.</param> |
| | 56 | | /// <returns>The BlobExtractionMode as a string.</returns> |
| 6 | 57 | | public static explicit operator string(BlobExtractionMode mode) => mode.ToString(); |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Compares two BlobExtractionMode values for equality. |
| | 61 | | /// </summary> |
| | 62 | | /// <param name="lhs">The first BlobExtractionMode to compare.</param> |
| | 63 | | /// <param name="rhs">The second BlobExtractionMode to compare.</param> |
| | 64 | | /// <returns>true if the BlobExtractionMode objects are equal or are both null; false otherwise.</returns> |
| 0 | 65 | | public static bool operator ==(BlobExtractionMode lhs, BlobExtractionMode rhs) => Equals(lhs, rhs); |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Compares two BlobExtractionMode values for inequality. |
| | 69 | | /// </summary> |
| | 70 | | /// <param name="lhs">The first BlobExtractionMode to compare.</param> |
| | 71 | | /// <param name="rhs">The second BlobExtractionMode to compare.</param> |
| | 72 | | /// <returns>true if the BlobExtractionMode objects are not equal; false otherwise.</returns> |
| 0 | 73 | | public static bool operator !=(BlobExtractionMode lhs, BlobExtractionMode rhs) => !Equals(lhs, rhs); |
| | 74 | |
|
| | 75 | | /// <summary> |
| | 76 | | /// Compares the BlobExtractionMode for equality with another BlobExtractionMode. |
| | 77 | | /// </summary> |
| | 78 | | /// <param name="other">The BlobExtractionMode with which to compare.</param> |
| | 79 | | /// <returns><c>true</c> if the BlobExtractionMode objects are equal; otherwise, <c>false</c>.</returns> |
| 0 | 80 | | public bool Equals(BlobExtractionMode other) => _value == other._value; |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Determines whether the specified object is equal to the current object. |
| | 84 | | /// </summary> |
| | 85 | | /// <param name="obj">The object to compare with the current object.</param> |
| | 86 | | /// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</retur |
| 0 | 87 | | public override bool Equals(object obj) => obj is BlobExtractionMode ? Equals((BlobExtractionMode)obj) : false; |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Serves as the default hash function. |
| | 91 | | /// </summary> |
| | 92 | | /// <returns>A hash code for the current object.</returns> |
| 0 | 93 | | public override int GetHashCode() => _value.GetHashCode(); |
| | 94 | |
|
| | 95 | | /// <summary> |
| | 96 | | /// Returns a string representation of the BlobExtractionMode. |
| | 97 | | /// </summary> |
| | 98 | | /// <returns>The BlobExtractionMode as a string.</returns> |
| 6 | 99 | | public override string ToString() => _value; |
| | 100 | | } |
| | 101 | | } |