public override int GetHashCode()
        {
            int hash = 1;

            if (CredentialJson.Length != 0)
            {
                hash ^= CredentialJson.GetHashCode();
            }
            if (RevocationId.Length != 0)
            {
                hash ^= RevocationId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
        private GoogleCredential GetCredentialFromConfiguration()
        {
            var nullLogEvent   = LogEventInfo.CreateNullEvent();
            var credentialFile = CredentialFile?.Render(nullLogEvent);
            var credentialJson = CredentialJson?.Render(nullLogEvent);

            GaxPreconditions.CheckState(string.IsNullOrWhiteSpace(credentialFile) || string.IsNullOrWhiteSpace(credentialJson),
                                        $"{nameof(CredentialFile)} and {nameof(CredentialJson)} must not both be set.");
            var credential =
                !string.IsNullOrWhiteSpace(credentialFile) ? GoogleCredential.FromFile(credentialFile) :
                !string.IsNullOrWhiteSpace(credentialJson) ? GoogleCredential.FromJson(credentialJson) :
                null;

            if (credential == null)
            {
                return(null);
            }
            if (credential.IsCreateScopedRequired)
            {
                credential = credential.CreateScoped(s_oAuthScopes);
            }
            return(credential);
        }