예제 #1
0
 private T CheckAndReturn <T>(OneofType type)
 {
     if (Type != type)
     {
         throw new sys::InvalidOperationException($"Requested type {type}, but this one-of contains type {Type}");
     }
     return((T)Name);
 }
예제 #2
0
 /// <summary>
 /// Constructs a new instance of the <see cref="KeyNameOneof"/> resource name class
 /// from a suitable <see cref="gax::IResourceName"/> instance.
 /// </summary>
 public KeyNameOneof(OneofType type, gax::IResourceName name)
 {
     Type = gax::GaxPreconditions.CheckEnumValue <OneofType>(type, nameof(type));
     Name = gax::GaxPreconditions.CheckNotNull(name, nameof(name));
     if (!IsValid(type, name))
     {
         throw new sys::ArgumentException($"Mismatched OneofType '{type}' and resource name '{name}'");
     }
 }
예제 #3
0
        private static bool IsValid(OneofType type, gax::IResourceName name)
        {
            switch (type)
            {
            case OneofType.Unknown: return(true);    // Anything goes with Unknown.

            case OneofType.KeyRingName: return(name is KeyRingName);

            case OneofType.CryptoKeyName: return(name is CryptoKeyName);

            default: return(false);
            }
        }
예제 #4
0
        private static bool IsValid(OneofType type, IResourceName name)
        {
            switch (type)
            {
            case OneofType.Unknown: return(true);    // Anything goes with Unknown.

            case OneofType.TopicName: return(name is TopicName);

            case OneofType.DeletedTopicNameFixed: return(name is DeletedTopicNameFixed);

            default: return(false);
            }
        }
        private static bool IsValid(OneofType type, gax::IResourceName name)
        {
            switch (type)
            {
            case OneofType.Unknown: return(true);    // Anything goes with Unknown.

            case OneofType.AssetSecurityMarksName: return(name is AssetSecurityMarksName);

            case OneofType.FindingSecurityMarksName: return(name is FindingSecurityMarksName);

            default: return(false);
            }
        }
예제 #6
0
        private static bool IsValid(OneofType type, gax::IResourceName name)
        {
            switch (type)
            {
            case OneofType.Unknown: return(true);    // Anything goes with Unknown.

            case OneofType.NoteName: return(name is Grafeas.V1.NoteName);

            case OneofType.OccurrenceName: return(name is Grafeas.V1.OccurrenceName);

            default: return(false);
            }
        }
        private static bool IsValid(OneofType type, gax::IResourceName name)
        {
            switch (type)
            {
            case OneofType.Unknown: return(true);

            case OneofType.OrganizationAssetName: return(name is OrganizationAssetName);

            case OneofType.OrganizationSourceFindingName: return(name is OrganizationSourceFindingName);

            default: return(false);
            }
        }