text:
import unittest
from structures.binary_heap import MinHeap

class BinaryHeapTestCase(unittest.TestCase):

    def test_swap(self):
        heap = MinHeap([1, 2, 3, 4])
        heap.swap(0, 1)
        self.assertEqual(heap.storage, [2, 1, 3, 4])

    def test_get_parent(self):
        heap = MinHeap([1, 2, 3, 4, 5, 6, 7, 8, 9])

        parent_id, value = heap.get_parent(0)
        self.assertEqual(parent_id, 0)
        self.assertEqual(value, 1)

        parent_id, value = heap.get_parent(9)
        self.assertEqual(parent_id, 4)
        self.assertEqual(value, 5)

        parent_id, value = heap.get_parent(6)
        self.assertEqual(parent_id, 2)
        self.assertEqual(value, 3)

    def test_insert(self):
        heap = MinHeap.heapify([6, 1, 5, 4, 3, 2, 7])
        # print(heap)

        # 1st check: auto
        self.assertTrue(heap.validate())

        # 2nd check: manual
        for i in range(heap.size):
            parent_id, parent_val = heap.get_parent(i)
            # print('id: {} <= {}; val: {} <= {}'.format(
            #     i, parent_id, heap.storage[i], parent_val))
            self.assertLessEqual(parent_val, heap.storage[i])

    def test_height_of(self):
        heap = MinHeap.heapify([6, 1, 5, 4, 3, 2, 7, 8, 9, 0])
        self.assertEqual(heap.height_of(9), 3)
        self.assertEqual(heap.height_of(0), 0)
        self.assertEqual(heap.height_of(6), 2)
        self.assertEqual(heap.height_of(1), 1)
        self.assertEqual(heap.height_of(2), 1)

    def test_extract_min(self):
        heap = MinHeap.heapify([6, 1, 5, 4, 3, 2, 7])
        self.assertTrue(heap.validate())
        size = heap.size
        # print(heap)
        self.assertEqual(heap.extract_min(), 1)
        self.assertEqual(heap.size, size - 1)
        # print(heap)
        self.assertTrue(heap.validate())
        self.assertEqual(heap.extract_all(), [2, 3, 4, 5, 6, 7])
        self.assertEqual(heap.size, 0)


text:
namespace utils
{
    partial class EncoderForm
    {
        /// <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.txtInput = new System.Windows.Forms.TextBox();
            this.txtOutput = new System.Windows.Forms.TextBox();
            this.btnConvert = new System.Windows.Forms.Button();
            this.btnReConvert = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // txtInput
            //
            this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtInput.Location = new System.Drawing.Point(12, 12);
            this.txtInput.Multiline = true;
            this.txtInput.Name = "txtInput";
            this.txtInput.Size = new System.Drawing.Size(300, 437);
            this.txtInput.TabIndex = 0;
            //
            // txtOutput
            //
            this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtOutput.Location = new System.Drawing.Point(392, 12);
            this.txtOutput.Multiline = true;
            this.txtOutput.Name = "txtOutput";
            this.txtOutput.ReadOnly = true;
            this.txtOutput.Size = new System.Drawing.Size(298, 437);
            this.txtOutput.TabIndex = 1;
            //
            // btnConvert
            //
            this.btnConvert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
            this.btnConvert.Location = new System.Drawing.Point(327, 191);
            this.btnConvert.Name = "btnConvert";
            this.btnConvert.Size = new System.Drawing.Size(49, 23);
            this.btnConvert.TabIndex = 2;
            this.btnConvert.Text = ">>";
            this.btnConvert.UseVisualStyleBackColor = true;
            this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
            //
            // btnReConvert
            //
            this.btnReConvert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
            this.btnReConvert.Location = new System.Drawing.Point(327, 219);
            this.btnReConvert.Name = "btnReConvert";
            this.btnReConvert.Size = new System.Drawing.Size(49, 23);
            this.btnReConvert.TabIndex = 3;
            this.btnReConvert.Text = "<<";
            this.btnReConvert.UseVisualStyleBackColor = true;
            this.btnReConvert.Click += new System.EventHandler(this.btnReConvert_Click);
            //
            // EncoderForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(702, 461);
            this.Controls.Add(this.btnReConvert);
            this.Controls.Add(this.btnConvert);
            this.Controls.Add(this.txtOutput);
            this.Controls.Add(this.txtInput);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "EncoderForm";
            this.Text = "String To Hex";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox txtInput;
        private System.Windows.Forms.TextBox txtOutput;
        private System.Windows.Forms.Button btnConvert;
        private System.Windows.Forms.Button btnReConvert;
    }
}

redpajama_set_name: RedPajamaGithub


text:
class Treefrog < Formula
  desc "High-speed C++ MVC Framework for Web Application"
  homepage "http://www.treefrogframework.org/"
  url "https://github.com/treefrogframework/treefrog-framework/archive/v1.16.0.tar.gz"
  sha256 "b125f2b45d65423c6affd2fd7c60c8534de6d85d06a25d8b65035e4bdb79e73b"
  head "https://github.com/treefrogframework/treefrog-framework.git", :branch => "master"

  bottle do
    sha256 "2a4470cf711ba14f03710e7a354e2ee0b0caf2447aea0fad6e47f5bdd34f0b2f" => :sierra
    sha256 "010a880f394a57da1ca2e8094dba9003dbbec3cd3f6135005cfdc9e4282b3dd6" => :el_capitan
  end

  deprecated_option "with-qt5" => "with-qt"

  option "with-mysql", "enable --with-mysql option for Qt build"
  option "with-postgresql", "enable --with-postgresql option for Qt build"
  option "with-qt", "build and link with QtGui module"

  depends_on :macos => :el_capitan
  depends_on :xcode => [:build, "8.0"]

  qt_build_options = []
  qt_build_options << "with-mysql" if build.with?("mysql")
  qt_build_options << "with-postgresql" if build.with?("postgresql")
  depends_on "qt" => qt_build_options

  def install
    args = ["--prefix=#{prefix}"]
    args << "--enable-gui-mod" if build.with? "qt"

    system "./configure", *args

    cd "src" do
      system "make"
      system "make", "install"
    end

    cd "tools" do
      system "make"
      system "make", "install"
    end
  end

  test do
    system bin/"tspawn", "new", "hello"
    assert File.exist?("hello")
    cd "hello" do
      assert File.exist?("hello.pro")
      system HOMEBREW_PREFIX/"opt/qt/bin/qmake"
      assert File.exist?("Makefile")
      system "make"
      system bin/"treefrog", "-v"
    end
  end
end


text:
import EmberObject from '@ember/object';
import { merge } from '@ember/polyfills';
import { warn } from '../../util/logger';

export default EmberObject.extend({

  database: null,

  request(opts) {
    return this.get('database').request(opts);
  },

  reportWarning(warning, opts) {
    warn(`_find:`, warning, opts);
  },

  _query(url, opts) {
    opts = merge({}, opts);
    return this.request({
      method: 'post',
      url: url,
      json: true,
      body: {
        selector:  opts.selector,
        limit:     opts.limit,
        skip:      opts.skip,
        sort:      opts.sort,
        fields:    opts.fields,
        use_index: opts.use_index
      }
    }).then(results => {
      if(results.warning) {
        this.reportWarning(results.warning, opts);
      }
      return results;
    });
  },

  find(opts) {
    return this._query('_find', opts);
  },

  explain(opts) {
    return this._query('_explain', opts);
  },

  //

  save(ddoc, name, index) {
    return this.request({
      method: 'post',
      url: '_index',
      json: true,
      body: {
        ddoc,
        name,
        index
      }
    });
  },

  all() {
    return this.request({
      method: 'get',
      url: '_index',
      json: true
    });
  },

  delete(ddoc, name) {
    return this.request({
      method: 'delete',
      url: `_index/${ddoc}/json/${name}`,
      json: true
    });
  }

});


text:
<?php
namespace EXS\ErrorBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="exception5xx")
 */
class Exception5xx
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    protected $statusCode;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $file;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    protected $line;

    /**
     * @ORM\Column(type="text", nullable=true)
     */
    protected $message;

    /**
     * @ORM\Column(type="text", nullable=true)
     */
    protected $trace;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $requestUrl;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $referrer;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $userAgent;

    /**
     * @ORM\Column(type="string", length=45, nullable=true)
     */
    protected $remoteIp;

    /**
     * @ORM\Column(type="string", length=10, nullable=true)
     */
    protected $method;

    /**
     * @ORM\Column(type="text", nullable=true)
     */
    protected $queryString;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $hostname;

    /**
     * @ORM\Column(type="text", nullable=true)
     */
    protected $request;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $logged;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set statusCode
     *
     * @param  integer      $statusCode
     * @return Exception5xx
     */
    public function setStatusCode($statusCode)
    {
        $this->statusCode = $statusCode;

        return $this;
    }

    /**
     * Get statusCode
     *
     * @return integer
     */
    public function getStatusCode()
    {
        return $this->statusCode;
    }

    /**
     * Set file
     *
     * @param  string       $file
     * @return Exception5xx
     */
    public function setFile($file)
    {
        $this->file = $file;

        return $this;
    }

    /**
     * Get file
     *
     * @return string
     */
    public function getFile()
    {
        return $this->file;
    }

    /**
     * Set line
     *
     * @param $line
     * @return Exception5xx
     */
    public function setLine($line)
    {
        $this->line = $line;

        return $this;
    }

    /**
     * Get line
     *
     * @return \integer
     */
    public function getLine()
    {
        return $this->line;
    }

    /**
     * Set message
     *
     * @param  string       $message
     * @return Exception5xx
     */
    public function setMessage($message)
    {
        $this->message = $message;

        return $this;
    }

    /**
     * Get message
     *
     * @return string
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * Set trace
     *
     * @param  string       $trace
     * @return Exception5xx
     */
    public function setTrace($trace)
    {
        $this->trace = $trace;

        return $this;
    }

    /**
     * Get trace
     *
     * @return string
     */
    public function getTrace()
    {
        return $this->trace;
    }

    /**
     * Set requestUrl
     *
     * @param  string       $requestUrl
     * @return Exception5xx
     */
    public function setRequestUrl($requestUrl)
    {
        $this->requestUrl = $requestUrl;

        return $this;
    }

    /**
     * Get requestUrl
     *
     * @return string
     */
    public function getRequestUrl()
    {
        return $this->requestUrl;
    }

    /**
     * Set referrer
     *
     * @param  string       $referrer
     * @return Exception5xx
     */
    public function setReferrer($referrer)
    {
        $this->referrer = $referrer;

        return $this;
    }

    /**
     * Get referrer
     *
     * @return string
     */
    public function getReferrer()
    {
        return $this->referrer;
    }

    /**
     * Set userAgent
     *
     * @param  string       $userAgent
     * @return Exception5xx
     */
    public function setUserAgent($userAgent)
    {
        $this->userAgent = $userAgent;

        return $this;
    }

    /**
     * Get userAgent
     *
     * @return string
     */
    public function getUserAgent()
    {
        return $this->userAgent;
    }

    /**
     * Set remoteIp
     *
     * @param  string       $remoteIp
     * @return Exception5xx
     */
    public function setRemoteIp($remoteIp)
    {
        $this->remoteIp = $remoteIp;

        return $this;
    }

    /**
     * Get remoteIp
     *
     * @return string
     */
    public function getRemoteIp()
    {
        return $this->remoteIp;
    }

    /**
     * Set method
     *
     * @param  string       $method
     * @return Exception5xx
     */
    public function setMethod($method)
    {
        $this->method = $method;

        return $this;
    }

    /**
     * Get method
     *
     * @return string
     */
    public function getMethod()
    {
        return $this->method;
    }

    /**
     * Set queryString
     *
     * @param  string       $queryString
     * @return Exception5xx
     */
    public function setQueryString($queryString)
    {
        $this->queryString = $queryString;

        return $this;
    }

    /**
     * Get queryString
     *
     * @return string
     */
    public function getQueryString()
    {
        return $this->queryString;
    }

    /**
     * Set hostname
     *
     * @param  string       $hostname
     * @return Exception5xx
     */
    public function setHostname($hostname)
    {
        $this->hostname = $hostname;

        return $this;
    }

    /**
     * Get hostname
     *
     * @return string
     */
    public function getHostname()
    {
        return $this->hostname;
    }

    /**
     * Set request
     *
     * @param  string       $request
     * @return Exception5xx
     */
    public function setRequest($request)
    {
        $this->request = $request;

        return $this;
    }

    /**
     * Get request
     *
     * @return string
     */
    public function getRequest()
    {
        return $this->request;
    }

    /**
     * Set logged
     *
     * @param  \DateTime    $logged
     * @return Exception5xx
     */
    public function setLogged($logged)
    {
        $this->logged = $logged;

        return $this;
    }

    /**
     * Get logged
     *
     * @return \DateTime
     */
    public function getLogged()
    {
        return $this->logged;
    }
}


text:
<!DOCTYPE html>

  <title>TestNG new reports</title>

    <link type="text/css" href="testng-reports.css" rel="stylesheet" />

      Test results

      1 suite

        All suites

              Suite1

              Info

                    C:\Users\ProKarma\Downloads\RallyRestToolkitForJava-master\RallyRestToolkitForJava-master\src\test\resources\com\automation\Rally\Automation_Rally.xml

                    1 test

                    0 groups

                    Times

                    Reporter output

                    Ignored methods

                    Chronological view

                Results

                    1 method,   1 passed

                    Passed methods

                       (hide)
                       (show)

                        shouldIntialize

              com.rallydev.rest.client.HttpClientTest

                  shouldIntialize

            C:\Users\ProKarma\Downloads\RallyRestToolkitForJava-master\RallyRestToolkitForJava-master\src\test\resources\com\automation\Rally\Automation_Rally.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite1">
  <test name="exampletest1" preserve-order="true">
    <classes>
      <class name="com.rallydev.rest.client.HttpClientTest">
        <methods>
          <include name="shouldIntialize"/>
        </methods>
      </class> <!-- com.rallydev.rest.client.HttpClientTest -->
    </classes>
  </test> <!-- exampletest1 -->
</suite> <!-- Suite1 -->

            Tests for Suite1

                exampletest1 (1 class)

            Groups for Suite1

            Times for Suite1

              Total running time: 391 ms

            Reporter output for Suite1

            14 ignored methods

              com.rallydev.rest.client.HttpClientTest

                shouldDelete

                shouldExplodeWithInvalidResponse

                shouldSetProxyWithCredentials

                shouldGzip

                shouldSetApplicationName

                shouldSetWsapiVersion

                shouldGet

                shouldSetApplicationVendor

                shouldSetProxy

                shouldSetApplicationVersion

                shouldUseDefaultWsapiVersion

                shouldPost

                shouldReturnValidResponse

                shouldPut

            Methods in chronological order

com.rallydev.rest.client.HttpClientTest

                setUp
                0 ms

                shouldIntialize
                423 ms


text:
'use strict';
var controller = angular.module('cryptonomica.controller', [
        'cryptonomica.controller.home',
        'cryptonomica.controller.registration',
        'cryptonomica.controller.dashboard',
        'cryptonomica.controller.search',
        'cryptonomica.controller.viewprofile',
        'cryptonomica.controller.key',
        'cryptonomica.controller.verification',
        'cryptonomica.controller.showAllNotaries',
        'cryptonomica.controller.showallarbitrators',
        'cryptonomica.controller.proofOfExistence',
        'cryptonomica.controller.onlineVerification',
        'cryptonomica.controller.onlineVerificationView',
        'cryptonomica.controller.ethereumVerification',
        'cryptonomica.controller.verifyEthAddress',
        'cryptonomica.controller.openPGPOnline',
        'cryptonomica.controller.test',
        'cryptonomica.controller.arbitration',
        'cryptonomica.controller.promocode',
        'cryptonomica.controller.stats',
        'cryptonomica.controller.admin',
        'cryptonomica.controller.viewpromocode',
        'cryptonomica.controller.webinars',
        'cryptonomica.controller.payments'
    ]
);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Agaricus subcorticalis Cooke & Massee

### Remarks
null


text:
package fi.helsinki.cs.nodes.libubispark

import collection.JavaConverters._

/**
  * Created by lagerspe on 21.2.2017.
  */
object Utils {
  /**
    * Counts the number of elements of an iterator using a while loop rather than calling
    * [[scala.collection.Iterator#size]] because it uses a for loop, which is slightly slower
    * in the current version of Scala.
    */
  def getIteratorSize[T](iterator: Iterator[T]): Long = {
    var count = 0L
    while (iterator.hasNext) {
      count += 1L
      iterator.next()
    }
    count
  }

  /**
    * Returns the system properties map that is thread-safe to iterator over. It gets the
    * properties which have been set explicitly, as well as those for which only a default value
    * has been defined.
    */
  def getSystemProperties: Map[String, String] = {
    System.getProperties.stringPropertyNames().asScala
      .map(key => (key, System.getProperty(key))).toMap
  }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>MAGMA: /Users/mgates/Documents/magma-trunk/tools/magma-1.6.1/control Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

MAGMA
    1.6.1

Matrix Algebra for GPU and Multicore Architectures

Main Page

Related Pages

Modules

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

 All Classes Files Functions Friends Groups Pages

control Directory Reference

Files

file  	affinity.cpp

file  	affinity.h

file  	auxiliary.cpp

file  	batched_kernel_param.h

file  	bulge_auxiliary.cpp

file  	common_magma.h

file  	connection_mgpu.cpp

file  	constants.cpp

file  	cpanel_to_q.cpp

file  	cprint.cpp

file  	dpanel_to_q.cpp

file  	dprint.cpp

file  	get_nb.cpp

file  	ilaenv.cpp

file  	ilaenv_f77.f

file  	magma_cf77.cpp

file  	magma_cnan_inf.cpp

file  	magma_df77.cpp

file  	magma_dnan_inf.cpp

file  	magma_f77.cpp

file  	magma_sf77.cpp

file  	magma_snan_inf.cpp

file  	magma_threadsetting.cpp

file  	magma_threadsetting.h

file  	magma_timer.cpp

file  	magma_timer.h

file  	magma_zf77.cpp

file  	magma_zf77pgi.cpp

file  	magma_znan_inf.cpp

file  	magmawinthread.cpp

file  	magmawinthread.h

file  	pthread_barrier.cpp

file  	pthread_barrier.h

file  	sizeptr.c

file  	spanel_to_q.cpp

file  	sprint.cpp

file  	strlcpy.cpp

file  	thread_queue.cpp

file  	thread_queue.hpp

file  	trace.cpp

file  	trace.h

file  	transpose.h

file  	xerbla.cpp

file  	zpanel_to_q.cpp

file  	zprint.cpp

control

Generated on Fri Jan 30 2015 19:00:48 for MAGMA by

     1.8.7


text:
// CSecurityPlugin.h
//
// Copyright 2006, Cyrus Daboo.  All Rights Reserved.
//
// Created: 04-May-1998
// Author: Cyrus Daboo
// Platforms: Mac OS, Win32
//
// Description:
// This class implements a wrapper for DLL based security plug-ins in Mulberry.
//
// History:
// CD:	 04-May-1998:	Created initial header and implementation.
//

#ifndef __CSECURITYPLUGIN__MULBERRY__
#define __CSECURITYPLUGIN__MULBERRY__

#include "CPlugin.h"

// Classes
class CMessage;
class CMessageCryptoInfo;
class CAttachment;

#if __dest_os == __mac_os
	typedef CFragConnectionID TDLLInstance;
#elif __dest_os == __mac_os_x
	typedef CFBundleRef TDLLInstance;
#elif __dest_os == __win32_os
	typedef HANDLE TDLLInstance;
#elif __dest_os == __linux_os
	typedef void* TDLLInstance;
#else
#error __dest_os
#endif

class CCertificateManagerCOM;

class CSecurityPlugin : public CPlugin
{

public:

	enum ESecureMessage
	{
		eNone = 0,
		eSign,
		eEncrypt,
		eEncryptSign
	};

	// Actual plug-in class

	CSecurityPlugin(fspec files) :
		CPlugin(files) {}
	virtual ~CSecurityPlugin() {}

	static void RegisterSecurityPlugin(CSecurityPlugin* plugin);
	static CSecurityPlugin* GetRegisteredPlugin(const cdstring& descriptor);
	static CSecurityPlugin* GetDefaultPlugin();

	// Initialise/terminate
	virtual bool VerifyVersion() const;					// Make sure version matches
	virtual void LoadPlugin();							// Set callback on each load

	// Calls codes

	// Signing/encryption

	// Top call
	bool ProcessMessage(CMessage* msg, ESecureMessage mode, const char* key);

protected:
	// Operations on entire body
	void ProcessBody(CMessage* msg, ESecureMessage mode, const char* key);
	bool FileBody(const CAttachment* part, unsigned long& size) const;

	// Operations on single parts
	bool CanSecureAttachment(const CAttachment* part) const;
	bool FileAttachment(const CAttachment* part) const;
	void ProcessAttachment(CMessage* msg, CAttachment* part, ESecureMessage mode, const char* key);

	// Data process from message
	void Process(const CMessage* msg,
						ESecureMessage mode,
						const char* in,
						fspec fin,
						const char* key,
						char** out,
						fspec fout,
						unsigned long* out_len,
						bool useMIME,
						bool binary);

	bool DoesEncryptSignAllInOne() const;
	bool UseMIME() const;

	// Verifying/decryption
public:
	static bool VerifyDecryptPart(CMessage* msg, CAttachment* part, CMessageCryptoInfo& info);

protected:
	typedef std::map<cdstring, CSecurityPlugin*> SSecurityPluginHandlers;
	static SSecurityPluginHandlers	sSecurityPlugins;
	static cdstring sPreferredPlugin;

	static cdstrmap sCanVerify;
	static cdstrmap sCanDecrypt;

	static CSecurityPlugin* GetVerifyPlugin(const cdstring& type);
	static CSecurityPlugin* GetDecryptPlugin(const cdstring& type);

	bool VerifyDecryptPartInternal(CMessage* msg, CAttachment* part, CMessageCryptoInfo& info);

	bool FileVerifyDecrypt(const CMessage* msg) const;

	bool VerifyMessage(CMessage* msg, CMessageCryptoInfo& info);
	bool DecryptMessage(CMessage* msg, CMessageCryptoInfo& info, bool use_multi_part);

	long HandleError(CMessageCryptoInfo* info = NULL);

	enum ESecurityPluginCall
	{
		// Derived plug-in calls
		eSecuritySignData = CPlugin::ePluginFirstSubCode,	// First code availble for sub-class calls
		eSecurityEncryptData,
		eSecurityEncryptSignData,
		eSecurityDecryptVerifyData,
		eSecuritySignFile,
		eSecurityEncryptFile,
		eSecurityEncryptSignFile,
		eSecurityDecryptVerifyFile,

		eSecurityDisposeData,

		eSecurityGetLastError,

		eSecurityGetMIMEParamsSign,
		eSecurityGetMIMEParamsEncrypt,
		eSecurityGetMIMEParamsEncryptSign,

		eSecuritySetCallback,

		eSecurityCanVerifyThis,
		eSecurityCanDecryptThis,

		eSecuritySetSMIMEContext
	};

	enum ESecurityPluginCallback
	{
		eCallbackPassphrase = 1
	};

	typedef bool (*CallbackProcPtr)(ESecurityPluginCallback type, void* data);

	enum ESecurityError
	{
		eSecurity_NoErr = 0,
		eSecurity_UserAbort,
		eSecurity_BadPassphrase,
		eSecurity_KeyUnavailable,
		eSecurity_InvalidSignature,
		eSecurity_DubiousKey,
		eSecurity_UnknownError = -1L
	};

#if __dest_os == __mac_os
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
#endif

	struct SSignData
	{
		const char* mInputData;
		const char* mKey;
		char** mOutputData;
		unsigned long* mOutputDataLength;
		bool mUseMIME;
		bool mBinary;
	};

	struct SEncryptData
	{
		const char* mInputData;
		const char** mKeys;
		char** mOutputData;
		unsigned long* mOutputDataLength;
		bool mUseMIME;
		bool mBinary;
	};

	struct SEncryptSignData
	{
		const char* mInputData;
		const char** mKeys;
		const char* mSignKey;
		char** mOutputData;
		unsigned long* mOutputDataLength;
		bool mUseMIME;
		bool mBinary;
	};

	struct SDecryptVerifyData
	{
		const char* mInputData;
		const char* mInputSignature;
		const char* mInputFrom;
		char** mOutputData;
		unsigned long* mOutputDataLength;
		char** mOutputSignedby;
		char** mOutputEncryptedto;
		bool* mSuccess;
		bool* mDidSig;
		bool* mSigOK;
		bool mBinary;
	};

	struct SSignFile
	{
		fspec_old mInputFile;
		const char* mKey;
		fspec_old mOutputFile;
		bool mUseMIME;
		bool mBinary;
	};

	struct SEncryptFile
	{
		fspec_old mInputFile;
		const char** mKeys;
		fspec_old mOutputFile;
		bool mUseMIME;
		bool mBinary;
	};

	struct SEncryptSignFile
	{
		fspec_old mInputFile;
		const char** mKeys;
		const char* mSignKey;
		fspec_old mOutputFile;
		bool mUseMIME;
		bool mBinary;
	};

	struct SDecryptVerifyFile
	{
		fspec_old mInputFile;
		const char* mInputSignature;
		const char* mInputFrom;
		fspec_old mOutputFile;
		char** mOutputSignedby;
		char** mOutputEncryptedto;
		bool* mSuccess;
		bool* mDidSig;
		bool* mSigOK;
		bool mBinary;
	};

	struct SGetLastError
	{
		long* errnum;
		char** error;
	};

	struct SMIMEInfo
	{
		const char* type;
		const char* subtype;
		const char** params;

		SMIMEInfo()
			{ type = NULL; subtype = NULL; params = NULL; }
	};

	struct SMIMEMultiInfo
	{
		SMIMEInfo multipart;
		SMIMEInfo first;
		SMIMEInfo second;
	};

	struct SCallbackPassphrase
	{
		const char** users;
		char* passphrase;
		unsigned long chosen;
	};

	struct SSMIMEContext
	{
		TDLLInstance			mDLL;
		CCertificateManagerCOM*	mCertMgr;
	};

#if __dest_os == __mac_os
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
#endif

	static cdstrmap sPassphrases;
	static cdstring sLastPassphraseUID;

	// Utilities
#if __dest_os == __mac_os || __dest_os == __mac_os_x
	void CreateTempFile(PPx::FSObject* ftemp, ESecureMessage mode, const cdstring& name);
#else
	void CreateTempFile(cdstring& ftemp, ESecureMessage mode, const cdstring& name);
#endif
	void ApplyMIME(CAttachment* part, SMIMEInfo* info);

	// Operations on in memory daÁta
	virtual long 	SignData(const char* in,					// Sign data
								const char* key,
								char** out,
								unsigned long* out_len,
								bool useMime,
								bool binary);
	virtual long 	EncryptData(const char* in,					// Encrypt data
								const char** to,
								char** out,
								unsigned long* out_len,
								bool useMime,
								bool binary);
	virtual long 	EncryptSignData(const char* in,				// Encrypt & sign data
								const char** to,
								const char* key,
								char** out,
								unsigned long* out_len,
								bool useMime,
								bool binary);
	virtual long 	DecryptVerifyData(const char* in,			// Decrypt/verify data
								const char* sig,
								const char* in_from,
								char** out,
								unsigned long* out_len,
								char** out_signedby,
								char** out_encryptedto,
								bool* success,
								bool* did_sig,
								bool* sig_ok,
								bool binary);

	// Operations on files
	virtual long 	SignFile(fspec in,							// Sign file
								const char* key,
								fspec out,
								bool useMime,
								bool binary);
	virtual long 	EncryptFile(fspec in,						// Encrypt file
								const char** to,
								fspec out,
								bool useMime,
								bool binary);
	virtual long 	EncryptSignFile(fspec in,					// Encrypt & sign file
								const char** to,
								const char* key,
								fspec out,
								bool useMime,
								bool binary);
	virtual long 	DecryptVerifyFile(fspec in,					// Decrypt/verify file
								const char* sig,
								const char* in_from,
								fspec out,
								char** out_signedby,
								char** out_encryptedto,
								bool* success,
								bool* did_sig,
								bool* sig_ok,
								bool binary);

	virtual long	DisposeData(const char* data);

	virtual long	GetLastError(long* errnum, char** error);	// Get last error from plugin

	virtual long	GetMIMESign(SMIMEMultiInfo* params);		// Get MIME parameters for signing
	virtual long	GetMIMEEncrypt(SMIMEMultiInfo* params);		// Get MIME parameters for encryption
	virtual long	GetMIMEEncryptSign(SMIMEMultiInfo* params);	// Get MIME parameters for encryption

	virtual long	CanVerifyThis(const char* type);			// Check that MIME type is verifiable by this plugin
	virtual long	CanDecryptThis(const char* type);			// Check that MIME type is decryptable by this plugin

	virtual long	SetCallback();								// Set callback into Mulberry

	virtual long	SetContext();								// Set COM/dll into Mulberry

	// Callbacks to application
	static bool Callback(ESecurityPluginCallback type, void* data);

public:
	static bool GetPassphrase(const char** users, char* passphrase, unsigned long& chosen);
	static void ClearLastPassphrase();
};

#endif


text:
<?xml version='1.0' encoding='UTF-8'?>
<Document>
  <Header>
    <SchemaName>Location</SchemaName>
    <Identifier>location_geonames_6950466</Identifier>
    <DocumentState>public</DocumentState>
    <TimeStamp>1390753462244</TimeStamp>
    <SummaryFields>
      <Title>NL > North Brabant > Oude Zwartenbergse Molen</Title>
    </SummaryFields>
  </Header>
  <Body>
    <Location>
      <GeopoliticalHierarchy>NL,North Brabant,Oude Zwartenbergse Molen</GeopoliticalHierarchy>
      <LocationName>
        <Appelation>Oude Zwartenbergse Molen</Appelation>
        <LocationNameType>windmill</LocationNameType>
        <Comments></Comments>
      </LocationName>
      <Coordinates>
        <Longitude>4.65433</Longitude>
        <Latitude>51.60955</Latitude>
      </Coordinates>
      <GeonamesURI>http://www.geonames.org/6950466</GeonamesURI>
      <WikipediaLink/>
      <DbpediaLink/>
    </Location>
  </Body>
</Document>


text:
//---------------------------------------------------------------------
// <copyright file="SelectExpandPathBuilder.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.OData.Client
{
    #region Namespaces

    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Reflection;
    using Microsoft.OData.Client.ALinq.UriParser;
    using Microsoft.OData.Client.Metadata;

    #endregion Namespaces

    /// <summary>
    /// Holds state (Path, lambda parameter stack, etc) for projection analysis.
    /// </summary>
    internal class SelectExpandPathBuilder
    {
        #region Private fields

        /// <summary>
        /// This class is used as a marker for an entity projected in its entirety.
        /// </summary>
        private const char EntireEntityMarker = UriHelper.ASTERISK;

        /// <summary>
        /// The list of projection paths as PathSegmentTokens.
        /// </summary>
        private readonly List<PathSegmentToken> projectionPaths = new List<PathSegmentToken>();

        /// <summary>
        /// The list of expansion paths as PathSegmentTokens.
        /// </summary>
        private readonly List<PathSegmentToken> expandPaths = new List<PathSegmentToken>();

        /// <summary>
        /// The stack of parameter expressions.
        /// </summary>
        private readonly Stack<ParameterExpression> parameterExpressions = new Stack<ParameterExpression>();

        /// <summary>
        /// The dictionary linking parameter expressions to their base paths.
        /// </summary>
        private readonly Dictionary<ParameterExpression, PathSegmentToken> basePaths = new Dictionary<ParameterExpression, PathSegmentToken>(ReferenceEqualityComparer<ParameterExpression>.Instance);

        /// <summary>
        /// The request data service version for the projection and expand paths
        /// </summary>
        private Version uriVersion;

        /// <summary>
        /// Flag indicating whether we're processing the first segment in a new path.
        /// </summary>
        private bool firstSegmentInNewPath;

        /// <summary>
        /// Summary to indicate whether we're building from an empty base path or not
        /// </summary>
        private bool basePathIsEmpty;

        #endregion Private fields

        /// <summary>
        /// Initializes a new <see cref="SelectExpandPathBuilder"/> instance.
        /// </summary>
        public SelectExpandPathBuilder()
        {
            firstSegmentInNewPath = true;
            this.uriVersion = Util.ODataVersion4;
        }

        /// <summary>
        /// Get a list of strings that represent the current list of ProjectionPaths
        /// </summary>
        public IEnumerable<string> ProjectionPaths
        {
            get
            {
                return this.WriteProjectionPaths();
            }
        }

        /// <summary>
        /// Get a list of strings that represent the current list of ExpansionPaths.
        /// </summary>
        public IEnumerable<string> ExpandPaths
        {
            get
            {
                return this.WriteExpansionPaths();
            }
        }

        /// <summary>
        /// The request data service version for the projection and expand paths
        /// </summary>
        public Version UriVersion
        {
            get
            {
                return this.uriVersion;
            }
        }

        /// <summary>
        /// Get the parameter expression that is currently in scope.
        /// </summary>
        public ParameterExpression ParamExpressionInScope
        {
            get
            {
                Debug.Assert(parameterExpressions.Count > 0, "parameterExpressions.Count > 0");
                return parameterExpressions.Peek();
            }
        }

        /// <summary>
        /// Add a new ParameterExpression to the stack.
        /// </summary>
        /// <param name="pe">The parameter expression to add.</param>
        public void PushParamExpression(ParameterExpression pe)
        {
            PathSegmentToken basePath = expandPaths.LastOrDefault();
            basePaths.Add(pe, basePath);
            expandPaths.Remove(basePath);
            parameterExpressions.Push(pe);
        }

        /// <summary>
        /// Pop the top parameter expression off the stack.
        /// </summary>
        public void PopParamExpression()
        {
            parameterExpressions.Pop();
        }

        /// <summary>
        /// Starts a new path.
        /// </summary>
        public void StartNewPath()
        {
            Debug.Assert(this.ParamExpressionInScope != null, "this.ParamExpressionInScope != null -- should not be starting new path with no lambda parameter in scope.");

            PathSegmentToken basePath = basePaths[this.ParamExpressionInScope];
            PathSegmentToken newExpandPathToAdd;
            if (basePath != null)
            {
                NewTreeBuilder newTreeBuilder = new NewTreeBuilder();
                newExpandPathToAdd = basePath.Accept(newTreeBuilder);
            }
            else
            {
                newExpandPathToAdd = null;
            }

            expandPaths.Add(newExpandPathToAdd);

            firstSegmentInNewPath = true;
            basePathIsEmpty = basePath == null;
        }

        /// <summary>
        /// Appends the given property and source TypeAs to the projection and expand paths.
        /// </summary>
        /// <param name="pi">Navigation property</param>
        /// <param name="convertedSourceType">The TypeAs type if the source of the member access expression is a TypeAs operation. Null otherwise.</param>
        /// <param name="context">Data service context instance.</param>
        public void AppendPropertyToPath(PropertyInfo pi, Type convertedSourceType, DataServiceContext context)
        {
            Debug.Assert(pi != null, "pi != null");

            bool propertyTypeisEntityType = ClientTypeUtil.TypeOrElementTypeIsEntity(pi.PropertyType);

            string convertedSourceTypeName = (convertedSourceType == null) ?
                null :
                UriHelper.GetEntityTypeNameForUriAndValidateMaxProtocolVersion(convertedSourceType, context, ref this.uriVersion);

            string propertyServerDefinedName = ClientTypeUtil.GetServerDefinedName(pi);

            string propertyName = convertedSourceType != null ?
                String.Join(UriHelper.FORWARDSLASH.ToString(), new string[] { convertedSourceTypeName, propertyServerDefinedName }) :
                propertyServerDefinedName;

            if (propertyTypeisEntityType)
            {
                // an entity, so need to append to expand path only
                AppendToExpandPath(propertyName, false);
            }
            else
            {
                // if this is a non-entity, then it an either be
                // 1) a top level property that we're selecting
                //          -or-
                // 2) a lower level property being selected via a nav prop.
                //
                // if 1) Then we just add it to the projection path
                // if 2) then we add it to the expand path instead.

                // we decide that based on whether this is the first property we're adding to
                // the path, and whether the base path we're starting from is empty.
                if (firstSegmentInNewPath && basePathIsEmpty)
                {
                    AppendToProjectionPath(propertyName);
                }
                else
                {
                    AppendToExpandPath(propertyName, true);
                }
            }

            // clear the firstSegmentInPath flag
            firstSegmentInNewPath = false;
        }

        /// <summary>
        /// Write out the current list of expansion paths as a list of strings.
        /// </summary>
        /// <returns>The current list of expansion paths as a list of strings.</returns>
        private IEnumerable<string> WriteExpansionPaths()
        {
            SelectExpandPathToStringVisitor visitor = new SelectExpandPathToStringVisitor();
            return this.expandPaths.Where(path => path != null).Select(path => path.Accept(visitor));
        }

        /// <summary>
        /// Write out the current list of projection paths as a list of strings.
        /// </summary>
        /// <returns>The current list of projection paths as a list of strings.</returns>
        private IEnumerable<string> WriteProjectionPaths()
        {
            return this.projectionPaths.Where(path => path != null).Select(path => path.Identifier);
        }

        /// <summary>
        /// Appends a name of a property/link/type to the current projection path.
        /// </summary>
        /// <param name="name">name of the property/link/type which needs to be added to the select path.</param>
        private void AppendToProjectionPath(string name)
        {
            // get rid of the * if its present
            foreach (PathSegmentToken pathSegment in projectionPaths)
            {
                if (pathSegment != null && pathSegment.Identifier == EntireEntityMarker.ToString())
                {
                    projectionPaths.Remove(pathSegment);
                }
            }

            projectionPaths.Add(new NonSystemToken(name, /*namedValues*/ null, /*nextToken*/ null));
        }

        /// <summary>
        /// Appends a name of a property/link/type to the current expand path.
        /// </summary>
        /// <param name="name">name of the property/link/type which needs to be added to the expand path.</param>
        /// <param name="isStructural">is this a structural property.</param>
        private void AppendToExpandPath(string name, bool isStructural)
        {
            PathSegmentToken path = this.expandPaths.LastOrDefault();
            NonSystemToken newToken = new NonSystemToken(name, /*namedValues*/null, /*nextToken*/null);
            newToken.IsStructuralProperty = isStructural;
            if (path != null)
            {
                expandPaths.Remove(path);
                AddNewEndingTokenVisitor addNewEndingTokenVisitor = new AddNewEndingTokenVisitor(newToken);
                path.Accept(addNewEndingTokenVisitor);
                expandPaths.Add(path);
            }
            else
            {
                expandPaths.Add(newToken);
            }
        }
    }
}


text:
describe("LambDate", function() {
  var LambDate = require('../src/lambdate.js');

  beforeEach(function() {
    date = new Date();
    subject = new LambDate();
  });

  it("represents now", function() {
    expect(subject.toMs() / 100).toBeCloseTo(new Date().getTime() / 100, 1);
  });

  describe("with a known value", function() {
    it("returns a Date()", function() {
      expect(subject.toDate()).toEqual(date);
    });
  });

  describe("#plus", function() {
    it("increments", function() {
      result = subject.plus(1);
      expect(result.toMs()).toBeGreaterThan(subject.toMs());
    });

    it("returns a new object", function() {
      expect(subject.plus(1)).not.toBe(subject);
    });

    it("defaults to seconds", function() {
      result = subject.plus(1);
      expect(result.toMs()).toEqual(subject.toMs() + 1000);
    });

    it("takes seconds", function() {
      result = subject.plus(1, "second");
      expect(result.toMs()).toEqual(subject.toMs() + 1000);

      result = subject.plus(13, "seconds");
      expect(result.toMs()).toEqual(subject.toMs() + 13 * 1000);
    });

    it("takes minutes", function() {
      result = subject.plus(1, "minute");
      expect(result.toMs()).toEqual(subject.toMs() + 60 * 1000);

      result = subject.plus(13, "minutes");
      expect(result.toMs()).toEqual(subject.toMs() + 13 * 60 * 1000);
    });

    it("takes hours", function() {
      result = subject.plus(1, "hour");
      expect(result.toMs()).toEqual(subject.toMs() + 3600 * 1000);

      result = subject.plus(13, "hours");
      expect(result.toMs()).toEqual(subject.toMs() + 13 * 3600 * 1000);
    });

    it("takes days", function() {
      result = subject.plus(1, "day");
      expect(result.toMs()).toEqual(subject.toMs() + 24 * 3600 * 1000);

      result = subject.plus(13, "days");
      expect(result.toMs()).toEqual(subject.toMs() + 13 * 24 * 3600 * 1000);
    });

    it("throws an error for unknown units", function() {
      expect(function() {
        subject.plus(42, "lightyear")
      }).toThrow("Unknown unit 'lightyear'");
    });
  });

  describe("#minus", function() {
    it("decrements", function() {
      result = subject.minus(1);
      expect(result.toMs()).toBeLessThan(subject.toMs());
    });

    it("returns a new object", function() {
      expect(subject.plus(1)).not.toBe(subject);
    });

    it("defaults to seconds", function() {
      result = subject.minus(1);
      expect(result.toMs()).toEqual(subject.toMs() - 1000);
    });
  });

  describe("with months", function() {
    beforeEach(function() {
      date = new Date(2014, 6, 13, 9, 23, 44);
      subject = new LambDate(date);
    });

    describe("#plus", function() {
      it("adds exactly one month", function() {
        result = subject.plus(1, "month").toDate().toString();
        expect(result).toEqual("Wed Aug 13 2014 09:23:44 GMT+0200 (CEST)");
      });

      it("handles year changes", function() {
        result = subject.minus(7, "months").toDate().toString();
        expect(result).toEqual("Fri Dec 13 2013 09:23:44 GMT+0100 (CET)");
      });
    });
  });

  describe("with years", function() {
    beforeEach(function() {
      date = new Date(2014, 6, 13, 9, 23, 44);
      subject = new LambDate(date);
    });

    describe("#plus", function() {
      it("adds exactly one year", function() {
        result = subject.plus(1, "year").toDate().toString();
        expect(result).toEqual("Mon Jul 13 2015 09:23:44 GMT+0200 (CEST)");
      });
    });
  });

  describe("conversion", function() {
    beforeEach(function() {
      date = new Date(2014, 6, 13, 9, 23, 44);
      subject = new LambDate(date);
    });

    it("returns seconds", function() {
      expect(subject.toS()).toBe(1405236224);
    });

    it("returns milliseconds", function() {
      expect(subject.toMs()).toBe(1405236224000);
    });

    it("returns an object", function() {
      result = subject.toObj();
      expect(result.year).toBe(2014);
      expect(result.month).toBe(7);
      expect(result.day).toBe(13);
      expect(result.hour).toBe(9);
      expect(result.minute).toBe(23);
      expect(result.second).toBe(44);
      expect(result.millisecond).toBe(0);
    });

    it("#toString delegates to Date#toString", function() {
      expect(subject.toString()).toEqual("Sun Jul 13 2014 09:23:44 GMT+0200 (CEST)");
    });

    // does not work in every JS implementation. In browsers it should.
    xit("#toLocaleDateString delegates to Date#toLocaleDateString", function() {
      var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
      expect(subject.toString()).toEqual("Sonntag, 13. Juli 2014");
    });
  });
});


text:
// Copyright 2022 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beta

import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"strings"

	"github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
	"github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl/operations"
)

func (r *VpnTunnel) validate() error {

	if err := dcl.Required(r, "sharedSecret"); err != nil {
		return err
	}
	if err := dcl.RequiredParameter(r.Project, "Project"); err != nil {
		return err
	}
	return nil
}
func (r *VpnTunnel) basePath() string {
	params := map[string]interface{}{}
	return dcl.Nprintf("https://www.googleapis.com/compute/beta/", params)
}

func (r *VpnTunnel) getURL(userBasePath string) (string, error) {
	nr := r.urlNormalized()
	params := map[string]interface{}{
		"project":  dcl.ValueOrEmptyString(nr.Project),
		"location": dcl.ValueOrEmptyString(nr.Location),
		"name":     dcl.ValueOrEmptyString(nr.Name),
	}
	return dcl.URL("projects/{{project}}/regions/{{location}}/vpnTunnels/{{name}}", nr.basePath(), userBasePath, params), nil
}

func (r *VpnTunnel) listURL(userBasePath string) (string, error) {
	nr := r.urlNormalized()
	params := map[string]interface{}{
		"project":  dcl.ValueOrEmptyString(nr.Project),
		"location": dcl.ValueOrEmptyString(nr.Location),
	}
	return dcl.URL("projects/{{project}}/regions/{{location}}/vpnTunnels", nr.basePath(), userBasePath, params), nil

}

func (r *VpnTunnel) createURL(userBasePath string) (string, error) {
	nr := r.urlNormalized()
	params := map[string]interface{}{
		"project":  dcl.ValueOrEmptyString(nr.Project),
		"location": dcl.ValueOrEmptyString(nr.Location),
	}
	return dcl.URL("projects/{{project}}/regions/{{location}}/vpnTunnels", nr.basePath(), userBasePath, params), nil

}

func (r *VpnTunnel) deleteURL(userBasePath string) (string, error) {
	nr := r.urlNormalized()
	params := map[string]interface{}{
		"project":  dcl.ValueOrEmptyString(nr.Project),
		"location": dcl.ValueOrEmptyString(nr.Location),
		"name":     dcl.ValueOrEmptyString(nr.Name),
	}
	return dcl.URL("projects/{{project}}/regions/{{location}}/vpnTunnels/{{name}}", nr.basePath(), userBasePath, params), nil
}

// vpnTunnelApiOperation represents a mutable operation in the underlying REST
// API such as Create, Update, or Delete.
type vpnTunnelApiOperation interface {
	do(context.Context, *VpnTunnel, *Client) error
}

// newUpdateVpnTunnelSetLabelsRequest creates a request for an
// VpnTunnel resource's setLabels update type by filling in the update
// fields based on the intended state of the resource.
func newUpdateVpnTunnelSetLabelsRequest(ctx context.Context, f *VpnTunnel, c *Client) (map[string]interface{}, error) {
	req := map[string]interface{}{}
	res := f
	_ = res

	if v := f.Labels; !dcl.IsEmptyValueIndirect(v) {
		req["labels"] = v
	}
	return req, nil
}

// marshalUpdateVpnTunnelSetLabelsRequest converts the update into
// the final JSON request body.
func marshalUpdateVpnTunnelSetLabelsRequest(c *Client, m map[string]interface{}) ([]byte, error) {

	return json.Marshal(m)
}

type updateVpnTunnelSetLabelsOperation struct {
	// If the update operation has the REQUIRES_APPLY_OPTIONS trait, this will be populated.
	// Usually it will be nil - this is to prevent us from accidentally depending on apply
	// options, which should usually be unnecessary.
	ApplyOptions []dcl.ApplyOption
	FieldDiffs   []*dcl.FieldDiff
}

// do creates a request and sends it to the appropriate URL. In most operations,
// do will transcribe a subset of the resource into a request object and send a
// PUT request to a single URL.

func (op *updateVpnTunnelSetLabelsOperation) do(ctx context.Context, r *VpnTunnel, c *Client) error {
	_, err := c.GetVpnTunnel(ctx, r)
	if err != nil {
		return err
	}

	u, err := r.updateURL(c.Config.BasePath, "setLabels")
	if err != nil {
		return err
	}

	req, err := newUpdateVpnTunnelSetLabelsRequest(ctx, r, c)
	if err != nil {
		return err
	}

	c.Config.Logger.InfoWithContextf(ctx, "Created update: %#v", req)
	body, err := marshalUpdateVpnTunnelSetLabelsRequest(c, req)
	if err != nil {
		return err
	}
	resp, err := dcl.SendRequest(ctx, c.Config, "POST", u, bytes.NewBuffer(body), c.Config.RetryProvider)
	if err != nil {
		return err
	}

	var o operations.ComputeOperation
	if err := dcl.ParseResponse(resp.Response, &o); err != nil {
		return err
	}
	err = o.Wait(context.WithValue(ctx, dcl.DoNotLogRequestsKey, true), c.Config, r.basePath(), "GET")

	if err != nil {
		return err
	}

	return nil
}

func (c *Client) listVpnTunnelRaw(ctx context.Context, r *VpnTunnel, pageToken string, pageSize int32) ([]byte, error) {
	u, err := r.urlNormalized().listURL(c.Config.BasePath)
	if err != nil {
		return nil, err
	}

	m := make(map[string]string)
	if pageToken != "" {
		m["pageToken"] = pageToken
	}

	if pageSize != VpnTunnelMaxPage {
		m["pageSize"] = fmt.Sprintf("%v", pageSize)
	}

	u, err = dcl.AddQueryParams(u, m)
	if err != nil {
		return nil, err
	}
	resp, err := dcl.SendRequest(ctx, c.Config, "GET", u, &bytes.Buffer{}, c.Config.RetryProvider)
	if err != nil {
		return nil, err
	}
	defer resp.Response.Body.Close()
	return ioutil.ReadAll(resp.Response.Body)
}

type listVpnTunnelOperation struct {
	Items []map[string]interface{} `json:"items"`
	Token string                   `json:"nextPageToken"`
}

func (c *Client) listVpnTunnel(ctx context.Context, r *VpnTunnel, pageToken string, pageSize int32) ([]*VpnTunnel, string, error) {
	b, err := c.listVpnTunnelRaw(ctx, r, pageToken, pageSize)
	if err != nil {
		return nil, "", err
	}

	var m listVpnTunnelOperation
	if err := json.Unmarshal(b, &m); err != nil {
		return nil, "", err
	}

	var l []*VpnTunnel
	for _, v := range m.Items {
		res, err := unmarshalMapVpnTunnel(v, c, r)
		if err != nil {
			return nil, m.Token, err
		}
		res.Project = r.Project
		res.Location = r.Location
		l = append(l, res)
	}

	return l, m.Token, nil
}

func (c *Client) deleteAllVpnTunnel(ctx context.Context, f func(*VpnTunnel) bool, resources []*VpnTunnel) error {
	var errors []string
	for _, res := range resources {
		if f(res) {
			// We do not want deleteAll to fail on a deletion or else it will stop deleting other resources.
			err := c.DeleteVpnTunnel(ctx, res)
			if err != nil {
				errors = append(errors, err.Error())
			}
		}
	}
	if len(errors) > 0 {
		return fmt.Errorf("%v", strings.Join(errors, "\n"))
	} else {
		return nil
	}
}

type deleteVpnTunnelOperation struct{}

func (op *deleteVpnTunnelOperation) do(ctx context.Context, r *VpnTunnel, c *Client) error {
	r, err := c.GetVpnTunnel(ctx, r)
	if err != nil {
		if dcl.IsNotFound(err) {
			c.Config.Logger.InfoWithContextf(ctx, "VpnTunnel not found, returning. Original error: %v", err)
			return nil
		}
		c.Config.Logger.WarningWithContextf(ctx, "GetVpnTunnel checking for existence. error: %v", err)
		return err
	}

	u, err := r.deleteURL(c.Config.BasePath)
	if err != nil {
		return err
	}

	// Delete should never have a body
	body := &bytes.Buffer{}
	resp, err := dcl.SendRequest(ctx, c.Config, "DELETE", u, body, c.Config.RetryProvider)
	if err != nil {
		return err
	}

	// wait for object to be deleted.
	var o operations.ComputeOperation
	if err := dcl.ParseResponse(resp.Response, &o); err != nil {
		return err
	}
	if err := o.Wait(context.WithValue(ctx, dcl.DoNotLogRequestsKey, true), c.Config, r.basePath(), "GET"); err != nil {
		return err
	}

	// We saw a race condition where for some successful delete operation, the Get calls returned resources for a short duration.
	// This is the reason we are adding retry to handle that case.
	retriesRemaining := 10
	dcl.Do(ctx, func(ctx context.Context) (*dcl.RetryDetails, error) {
		_, err := c.GetVpnTunnel(ctx, r)
		if dcl.IsNotFound(err) {
			return nil, nil
		}
		if retriesRemaining > 0 {
			retriesRemaining--
			return &dcl.RetryDetails{}, dcl.OperationNotDone{}
		}
		return nil, dcl.NotDeletedError{ExistingResource: r}
	}, c.Config.RetryProvider)
	return nil
}

// Create operations are similar to Update operations, although they do not have
// specific request objects. The Create request object is the json encoding of
// the resource, which is modified by res.marshal to form the base request body.
type createVpnTunnelOperation struct {
	response map[string]interface{}
}

func (op *createVpnTunnelOperation) FirstResponse() (map[string]interface{}, bool) {
	return op.response, len(op.response) > 0
}

func (op *createVpnTunnelOperation) do(ctx context.Context, r *VpnTunnel, c *Client) error {
	c.Config.Logger.InfoWithContextf(ctx, "Attempting to create %v", r)
	u, err := r.createURL(c.Config.BasePath)
	if err != nil {
		return err
	}

	req, err := r.marshal(c)
	if err != nil {
		return err
	}
	resp, err := dcl.SendRequest(ctx, c.Config, "POST", u, bytes.NewBuffer(req), c.Config.RetryProvider)
	if err != nil {
		return err
	}
	// wait for object to be created.
	var o operations.ComputeOperation
	if err := dcl.ParseResponse(resp.Response, &o); err != nil {
		return err
	}
	if err := o.Wait(context.WithValue(ctx, dcl.DoNotLogRequestsKey, true), c.Config, r.basePath(), "GET"); err != nil {
		c.Config.Logger.Warningf("Creation failed after waiting for operation: %v", err)
		return err
	}
	c.Config.Logger.InfoWithContextf(ctx, "Successfully waited for operation")
	op.response, _ = o.FirstResponse()

	if _, err := c.GetVpnTunnel(ctx, r); err != nil {
		c.Config.Logger.WarningWithContextf(ctx, "get returned error: %v", err)
		return err
	}

	return nil
}

func (c *Client) getVpnTunnelRaw(ctx context.Context, r *VpnTunnel) ([]byte, error) {
	if dcl.IsZeroValue(r.IkeVersion) {
		r.IkeVersion = dcl.Int64(2)
	}

	u, err := r.getURL(c.Config.BasePath)
	if err != nil {
		return nil, err
	}
	resp, err := dcl.SendRequest(ctx, c.Config, "GET", u, &bytes.Buffer{}, c.Config.RetryProvider)
	if err != nil {
		return nil, err
	}
	defer resp.Response.Body.Close()
	b, err := ioutil.ReadAll(resp.Response.Body)
	if err != nil {
		return nil, err
	}

	return b, nil
}

func (c *Client) vpnTunnelDiffsForRawDesired(ctx context.Context, rawDesired *VpnTunnel, opts ...dcl.ApplyOption) (initial, desired *VpnTunnel, diffs []*dcl.FieldDiff, err error) {
	c.Config.Logger.InfoWithContext(ctx, "Fetching initial state...")
	// First, let us see if the user provided a state hint.  If they did, we will start fetching based on that.
	var fetchState *VpnTunnel
	if sh := dcl.FetchStateHint(opts); sh != nil {
		if r, ok := sh.(*VpnTunnel); !ok {
			c.Config.Logger.WarningWithContextf(ctx, "Initial state hint was of the wrong type; expected VpnTunnel, got %T", sh)
		} else {
			fetchState = r
		}
	}
	if fetchState == nil {
		fetchState = rawDesired
	}

	// 1.2: Retrieval of raw initial state from API
	rawInitial, err := c.GetVpnTunnel(ctx, fetchState)
	if rawInitial == nil {
		if !dcl.IsNotFound(err) {
			c.Config.Logger.WarningWithContextf(ctx, "Failed to retrieve whether a VpnTunnel resource already exists: %s", err)
			return nil, nil, nil, fmt.Errorf("failed to retrieve VpnTunnel resource: %v", err)
		}
		c.Config.Logger.InfoWithContext(ctx, "Found that VpnTunnel resource did not exist.")
		// Perform canonicalization to pick up defaults.
		desired, err = canonicalizeVpnTunnelDesiredState(rawDesired, rawInitial)
		return nil, desired, nil, err
	}
	c.Config.Logger.InfoWithContextf(ctx, "Found initial state for VpnTunnel: %v", rawInitial)
	c.Config.Logger.InfoWithContextf(ctx, "Initial desired state for VpnTunnel: %v", rawDesired)

	// The Get call applies postReadExtract and so the result may contain fields that are not part of API version.
	if err := extractVpnTunnelFields(rawInitial); err != nil {
		return nil, nil, nil, err
	}

	// 1.3: Canonicalize raw initial state into initial state.
	initial, err = canonicalizeVpnTunnelInitialState(rawInitial, rawDesired)
	if err != nil {
		return nil, nil, nil, err
	}
	c.Config.Logger.InfoWithContextf(ctx, "Canonicalized initial state for VpnTunnel: %v", initial)

	// 1.4: Canonicalize raw desired state into desired state.
	desired, err = canonicalizeVpnTunnelDesiredState(rawDesired, rawInitial, opts...)
	if err != nil {
		return nil, nil, nil, err
	}
	c.Config.Logger.InfoWithContextf(ctx, "Canonicalized desired state for VpnTunnel: %v", desired)

	// 2.1: Comparison of initial and desired state.
	diffs, err = diffVpnTunnel(c, desired, initial, opts...)
	return initial, desired, diffs, err
}

func canonicalizeVpnTunnelInitialState(rawInitial, rawDesired *VpnTunnel) (*VpnTunnel, error) {
	// TODO(magic-modules-eng): write canonicalizer once relevant traits are added.
	return rawInitial, nil
}

/*
* Canonicalizers
*
* These are responsible for converting either a user-specified config or a
* GCP API response to a standard format that can be used for difference checking.
* */

func canonicalizeVpnTunnelDesiredState(rawDesired, rawInitial *VpnTunnel, opts ...dcl.ApplyOption) (*VpnTunnel, error) {

	if dcl.IsZeroValue(rawDesired.IkeVersion) {
		rawDesired.IkeVersion = dcl.Int64(2)
	}

	if rawInitial == nil {
		// Since the initial state is empty, the desired state is all we have.
		// We canonicalize the remaining nested objects with nil to pick up defaults.

		return rawDesired, nil
	}
	canonicalDesired := &VpnTunnel{}
	if dcl.IsZeroValue(rawDesired.Labels) || (dcl.IsEmptyValueIndirect(rawDesired.Labels) && dcl.IsEmptyValueIndirect(rawInitial.Labels)) {
		// Desired and initial values are equivalent, so set canonical desired value to initial value.
		canonicalDesired.Labels = rawInitial.Labels
	} else {
		canonicalDesired.Labels = rawDesired.Labels
	}
	if dcl.StringCanonicalize(rawDesired.Name, rawInitial.Name) {
		canonicalDesired.Name = rawInitial.Name
	} else {
		canonicalDesired.Name = rawDesired.Name
	}
	if dcl.StringCanonicalize(rawDesired.Description, rawInitial.Description) {
		canonicalDesired.Description = rawInitial.Description
	} else {
		canonicalDesired.Description = rawDesired.Description
	}
	if dcl.StringCanonicalize(rawDesired.Location, rawInitial.Location) {
		canonicalDesired.Location = rawInitial.Location
	} else {
		canonicalDesired.Location = rawDesired.Location
	}
	if dcl.IsZeroValue(rawDesired.TargetVpnGateway) || (dcl.IsEmptyValueIndirect(rawDesired.TargetVpnGateway) && dcl.IsEmptyValueIndirect(rawInitial.TargetVpnGateway)) {
		// Desired and initial values are equivalent, so set canonical desired value to initial value.
		canonicalDesired.TargetVpnGateway = rawInitial.TargetVpnGateway
	} else {
		canonicalDesired.TargetVpnGateway = rawDesired.TargetVpnGateway
	}
	if dcl.IsZeroValue(rawDesired.VpnGateway) || (dcl.IsEmptyValueIndirect(rawDesired.VpnGateway) && dcl.IsEmptyValueIndirect(rawInitial.VpnGateway)) {
		// Desired and initial values are equivalent, so set canonical desired value to initial value.
		canonicalDesired.VpnGateway = rawInitial.VpnGateway
	} else {
		canonicalDesired.VpnGateway = rawDesired.VpnGateway
	}
	if dcl.IsZeroValue(rawDesired.VpnGatewayInterface) || (dcl.IsEmptyValueIndirect(rawDesired.VpnGatewayInterface) && dcl.IsEmptyValueIndirect(rawInitial.VpnGatewayInterface)) {
		// Desired and initial values are equivalent, so set canonical desired value to initial value.
		canonicalDesired.VpnGatewayInterface = rawInitial.VpnGatewayInterface
	} else {
		canonicalDesired.VpnGatewayInterface = rawDesired.VpnGatewayInterface
	}
	if dcl.StringCanonicalize(rawDesired.PeerExternalGateway, rawInitial.PeerExternalGateway) {
		canonicalDesired.PeerExternalGateway = rawInitial.PeerExternalGateway
	} else {
		canonicalDesired.PeerExternalGateway = rawDesired.PeerExternalGateway
	}
	if dcl.IsZeroValue(rawDesired.PeerExternalGatewayInterface) || (dcl.IsEmptyValueIndirect(rawDesired.PeerExternalGatewayInterface) && dcl.IsEmptyValueIndirect(rawInitial.PeerExternalGatewayInterface)) {
		// Desired and initial values are equivalent, so set canonical desired value to initial value.
		canonicalDesired.PeerExternalGatewayInterface = rawInitial.PeerExternalGatewayInterface
	} else {
		canonicalDesired.PeerExternalGatewayInterface = rawDesired.PeerExternalGatewayInterface
	}
	if dcl.StringCanonicalize(rawDesired.PeerGcpGateway, rawInitial.PeerGcpGateway) {
		canonicalDesired.PeerGcpGateway = rawInitial.PeerGcpGateway
	} else {
		canonicalDesired.PeerGcpGateway = rawDesired.PeerGcpGateway
	}
	if dcl.PartialSelfLinkToSelfLink(rawDesired.Router, rawInitial.Router) {
		canonicalDesired.Router = rawInitial.Router
	} else {
		canonicalDesired.Router = rawDesired.Router
	}
	if dcl.StringCanonicalize(rawDesired.PeerIP, rawInitial.PeerIP) {
		canonicalDesired.PeerIP = rawInitial.PeerIP
	} else {
		canonicalDesired.PeerIP = rawDesired.PeerIP
	}
	if dcl.StringCanonicalize(rawDesired.SharedSecret, rawInitial.SharedSecret) {
		canonicalDesired.SharedSecret = rawInitial.SharedSecret
	} else {
		canonicalDesired.SharedSecret = rawDesired.SharedSecret
	}
	if dcl.IsZeroValue(rawDesired.IkeVersion) || (dcl.IsEmptyValueIndirect(rawDesired.IkeVersion) && dcl.IsEmptyValueIndirect(rawInitial.IkeVersion)) {
		// Desired and initial values are equivalent, so set canonical desired value to initial value.
		canonicalDesired.IkeVersion = rawInitial.IkeVersion
	} else {
		canonicalDesired.IkeVersion = rawDesired.IkeVersion
	}
	if dcl.StringArrayCanonicalize(rawDesired.LocalTrafficSelector, rawInitial.LocalTrafficSelector) {
		canonicalDesired.LocalTrafficSelector = rawInitial.LocalTrafficSelector
	} else {
		canonicalDesired.LocalTrafficSelector = rawDesired.LocalTrafficSelector
	}
	if dcl.StringArrayCanonicalize(rawDesired.RemoteTrafficSelector, rawInitial.RemoteTrafficSelector) {
		canonicalDesired.RemoteTrafficSelector = rawInitial.RemoteTrafficSelector
	} else {
		canonicalDesired.RemoteTrafficSelector = rawDesired.RemoteTrafficSelector
	}
	if dcl.NameToSelfLink(rawDesired.Project, rawInitial.Project) {
		canonicalDesired.Project = rawInitial.Project
	} else {
		canonicalDesired.Project = rawDesired.Project
	}

	return canonicalDesired, nil
}

func canonicalizeVpnTunnelNewState(c *Client, rawNew, rawDesired *VpnTunnel) (*VpnTunnel, error) {

	if dcl.IsEmptyValueIndirect(rawNew.Labels) && dcl.IsEmptyValueIndirect(rawDesired.Labels) {
		rawNew.Labels = rawDesired.Labels
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.Id) && dcl.IsEmptyValueIndirect(rawDesired.Id) {
		rawNew.Id = rawDesired.Id
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.Name) && dcl.IsEmptyValueIndirect(rawDesired.Name) {
		rawNew.Name = rawDesired.Name
	} else {
		if dcl.StringCanonicalize(rawDesired.Name, rawNew.Name) {
			rawNew.Name = rawDesired.Name
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.Description) && dcl.IsEmptyValueIndirect(rawDesired.Description) {
		rawNew.Description = rawDesired.Description
	} else {
		if dcl.StringCanonicalize(rawDesired.Description, rawNew.Description) {
			rawNew.Description = rawDesired.Description
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.Location) && dcl.IsEmptyValueIndirect(rawDesired.Location) {
		rawNew.Location = rawDesired.Location
	} else {
		if dcl.StringCanonicalize(rawDesired.Location, rawNew.Location) {
			rawNew.Location = rawDesired.Location
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.TargetVpnGateway) && dcl.IsEmptyValueIndirect(rawDesired.TargetVpnGateway) {
		rawNew.TargetVpnGateway = rawDesired.TargetVpnGateway
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.VpnGateway) && dcl.IsEmptyValueIndirect(rawDesired.VpnGateway) {
		rawNew.VpnGateway = rawDesired.VpnGateway
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.VpnGatewayInterface) && dcl.IsEmptyValueIndirect(rawDesired.VpnGatewayInterface) {
		rawNew.VpnGatewayInterface = rawDesired.VpnGatewayInterface
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.PeerExternalGateway) && dcl.IsEmptyValueIndirect(rawDesired.PeerExternalGateway) {
		rawNew.PeerExternalGateway = rawDesired.PeerExternalGateway
	} else {
		if dcl.StringCanonicalize(rawDesired.PeerExternalGateway, rawNew.PeerExternalGateway) {
			rawNew.PeerExternalGateway = rawDesired.PeerExternalGateway
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.PeerExternalGatewayInterface) && dcl.IsEmptyValueIndirect(rawDesired.PeerExternalGatewayInterface) {
		rawNew.PeerExternalGatewayInterface = rawDesired.PeerExternalGatewayInterface
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.PeerGcpGateway) && dcl.IsEmptyValueIndirect(rawDesired.PeerGcpGateway) {
		rawNew.PeerGcpGateway = rawDesired.PeerGcpGateway
	} else {
		if dcl.StringCanonicalize(rawDesired.PeerGcpGateway, rawNew.PeerGcpGateway) {
			rawNew.PeerGcpGateway = rawDesired.PeerGcpGateway
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.Router) && dcl.IsEmptyValueIndirect(rawDesired.Router) {
		rawNew.Router = rawDesired.Router
	} else {
		if dcl.PartialSelfLinkToSelfLink(rawDesired.Router, rawNew.Router) {
			rawNew.Router = rawDesired.Router
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.PeerIP) && dcl.IsEmptyValueIndirect(rawDesired.PeerIP) {
		rawNew.PeerIP = rawDesired.PeerIP
	} else {
		if dcl.StringCanonicalize(rawDesired.PeerIP, rawNew.PeerIP) {
			rawNew.PeerIP = rawDesired.PeerIP
		}
	}

	rawNew.SharedSecret = rawDesired.SharedSecret

	if dcl.IsEmptyValueIndirect(rawNew.SharedSecretHash) && dcl.IsEmptyValueIndirect(rawDesired.SharedSecretHash) {
		rawNew.SharedSecretHash = rawDesired.SharedSecretHash
	} else {
		if dcl.StringCanonicalize(rawDesired.SharedSecretHash, rawNew.SharedSecretHash) {
			rawNew.SharedSecretHash = rawDesired.SharedSecretHash
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.Status) && dcl.IsEmptyValueIndirect(rawDesired.Status) {
		rawNew.Status = rawDesired.Status
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.SelfLink) && dcl.IsEmptyValueIndirect(rawDesired.SelfLink) {
		rawNew.SelfLink = rawDesired.SelfLink
	} else {
		if dcl.StringCanonicalize(rawDesired.SelfLink, rawNew.SelfLink) {
			rawNew.SelfLink = rawDesired.SelfLink
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.IkeVersion) && dcl.IsEmptyValueIndirect(rawDesired.IkeVersion) {
		rawNew.IkeVersion = rawDesired.IkeVersion
	} else {
	}

	if dcl.IsEmptyValueIndirect(rawNew.DetailedStatus) && dcl.IsEmptyValueIndirect(rawDesired.DetailedStatus) {
		rawNew.DetailedStatus = rawDesired.DetailedStatus
	} else {
		if dcl.StringCanonicalize(rawDesired.DetailedStatus, rawNew.DetailedStatus) {
			rawNew.DetailedStatus = rawDesired.DetailedStatus
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.LocalTrafficSelector) && dcl.IsEmptyValueIndirect(rawDesired.LocalTrafficSelector) {
		rawNew.LocalTrafficSelector = rawDesired.LocalTrafficSelector
	} else {
		if dcl.StringArrayCanonicalize(rawDesired.LocalTrafficSelector, rawNew.LocalTrafficSelector) {
			rawNew.LocalTrafficSelector = rawDesired.LocalTrafficSelector
		}
	}

	if dcl.IsEmptyValueIndirect(rawNew.RemoteTrafficSelector) && dcl.IsEmptyValueIndirect(rawDesired.RemoteTrafficSelector) {
		rawNew.RemoteTrafficSelector = rawDesired.RemoteTrafficSelector
	} else {
		if dcl.StringArrayCanonicalize(rawDesired.RemoteTrafficSelector, rawNew.RemoteTrafficSelector) {
			rawNew.RemoteTrafficSelector = rawDesired.RemoteTrafficSelector
		}
	}

	rawNew.Project = rawDesired.Project

	return rawNew, nil
}

// The differ returns a list of diffs, along with a list of operations that should be taken
// to remedy them. Right now, it does not attempt to consolidate operations - if several
// fields can be fixed with a patch update, it will perform the patch several times.
// Diffs on some fields will be ignored if the `desired` state has an empty (nil)
// value. This empty value indicates that the user does not care about the state for
// the field. Empty fields on the actual object will cause diffs.
// TODO(magic-modules-eng): for efficiency in some resources, add batching.
func diffVpnTunnel(c *Client, desired, actual *VpnTunnel, opts ...dcl.ApplyOption) ([]*dcl.FieldDiff, error) {
	if desired == nil || actual == nil {
		return nil, fmt.Errorf("nil resource passed to diff - always a programming error: %#v, %#v", desired, actual)
	}

	c.Config.Logger.Infof("Diff function called with desired state: %v", desired)
	c.Config.Logger.Infof("Diff function called with actual state: %v", actual)

	var fn dcl.FieldName
	var newDiffs []*dcl.FieldDiff
	// New style diffs.
	if ds, err := dcl.Diff(desired.Labels, actual.Labels, dcl.DiffInfo{OperationSelector: dcl.TriggersOperation("updateVpnTunnelSetLabelsOperation")}, fn.AddNest("Labels")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.Id, actual.Id, dcl.DiffInfo{OutputOnly: true, OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("Id")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.Name, actual.Name, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("Name")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.Description, actual.Description, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("Description")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.Location, actual.Location, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("Region")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.TargetVpnGateway, actual.TargetVpnGateway, dcl.DiffInfo{Type: "ReferenceType", OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("TargetVpnGateway")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.VpnGateway, actual.VpnGateway, dcl.DiffInfo{Type: "ReferenceType", OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("VpnGateway")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.VpnGatewayInterface, actual.VpnGatewayInterface, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("VpnGatewayInterface")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.PeerExternalGateway, actual.PeerExternalGateway, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("PeerExternalGateway")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.PeerExternalGatewayInterface, actual.PeerExternalGatewayInterface, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("PeerExternalGatewayInterface")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.PeerGcpGateway, actual.PeerGcpGateway, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("PeerGcpGateway")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.Router, actual.Router, dcl.DiffInfo{Type: "ReferenceType", OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("Router")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.PeerIP, actual.PeerIP, dcl.DiffInfo{ServerDefault: true, OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("PeerIp")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.SharedSecret, actual.SharedSecret, dcl.DiffInfo{Ignore: true, OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("SharedSecret")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.SharedSecretHash, actual.SharedSecretHash, dcl.DiffInfo{OutputOnly: true, OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("SharedSecretHash")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.Status, actual.Status, dcl.DiffInfo{OutputOnly: true, Type: "EnumType", OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("Status")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.SelfLink, actual.SelfLink, dcl.DiffInfo{OutputOnly: true, OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("SelfLink")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.IkeVersion, actual.IkeVersion, dcl.DiffInfo{OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("IkeVersion")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.DetailedStatus, actual.DetailedStatus, dcl.DiffInfo{OutputOnly: true, OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("DetailedStatus")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.LocalTrafficSelector, actual.LocalTrafficSelector, dcl.DiffInfo{ServerDefault: true, Type: "Set", OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("LocalTrafficSelector")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.RemoteTrafficSelector, actual.RemoteTrafficSelector, dcl.DiffInfo{ServerDefault: true, Type: "Set", OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("RemoteTrafficSelector")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	if ds, err := dcl.Diff(desired.Project, actual.Project, dcl.DiffInfo{Type: "ReferenceType", OperationSelector: dcl.RequiresRecreate()}, fn.AddNest("Project")); len(ds) != 0 || err != nil {
		if err != nil {
			return nil, err
		}
		newDiffs = append(newDiffs, ds...)
	}

	return newDiffs, nil
}

// urlNormalized returns a copy of the resource struct with values normalized
// for URL substitutions. For instance, it converts long-form self-links to
// short-form so they can be substituted in.
func (r *VpnTunnel) urlNormalized() *VpnTunnel {
	normalized := dcl.Copy(*r).(VpnTunnel)
	normalized.Name = dcl.SelfLinkToName(r.Name)
	normalized.Description = dcl.SelfLinkToName(r.Description)
	normalized.Location = dcl.SelfLinkToName(r.Location)
	normalized.TargetVpnGateway = dcl.SelfLinkToName(r.TargetVpnGateway)
	normalized.VpnGateway = dcl.SelfLinkToName(r.VpnGateway)
	normalized.PeerExternalGateway = dcl.SelfLinkToName(r.PeerExternalGateway)
	normalized.PeerGcpGateway = dcl.SelfLinkToName(r.PeerGcpGateway)
	normalized.Router = dcl.SelfLinkToName(r.Router)
	normalized.PeerIP = dcl.SelfLinkToName(r.PeerIP)
	normalized.SharedSecret = dcl.SelfLinkToName(r.SharedSecret)
	normalized.SharedSecretHash = dcl.SelfLinkToName(r.SharedSecretHash)
	normalized.SelfLink = dcl.SelfLinkToName(r.SelfLink)
	normalized.DetailedStatus = dcl.SelfLinkToName(r.DetailedStatus)
	normalized.Project = dcl.SelfLinkToName(r.Project)
	return &normalized
}

func (r *VpnTunnel) updateURL(userBasePath, updateName string) (string, error) {
	nr := r.urlNormalized()
	if updateName == "setLabels" {
		fields := map[string]interface{}{
			"project":  dcl.ValueOrEmptyString(nr.Project),
			"location": dcl.ValueOrEmptyString(nr.Location),
		}
		return dcl.URL("projects/{{project}}/regions/{{location}}/vpnTunnels/setLabels", nr.basePath(), userBasePath, fields), nil

	}

	return "", fmt.Errorf("unknown update name: %s", updateName)
}

// marshal encodes the VpnTunnel resource into JSON for a Create request, and
// performs transformations from the resource schema to the API schema if
// necessary.
func (r *VpnTunnel) marshal(c *Client) ([]byte, error) {
	m, err := expandVpnTunnel(c, r)
	if err != nil {
		return nil, fmt.Errorf("error marshalling VpnTunnel: %w", err)
	}

	return json.Marshal(m)
}

// unmarshalVpnTunnel decodes JSON responses into the VpnTunnel resource schema.
func unmarshalVpnTunnel(b []byte, c *Client, res *VpnTunnel) (*VpnTunnel, error) {
	var m map[string]interface{}
	if err := json.Unmarshal(b, &m); err != nil {
		return nil, err
	}
	return unmarshalMapVpnTunnel(m, c, res)
}

func unmarshalMapVpnTunnel(m map[string]interface{}, c *Client, res *VpnTunnel) (*VpnTunnel, error) {

	flattened := flattenVpnTunnel(c, m, res)
	if flattened == nil {
		return nil, fmt.Errorf("attempted to flatten empty json object")
	}
	return flattened, nil
}

// expandVpnTunnel expands VpnTunnel into a JSON request object.
func expandVpnTunnel(c *Client, f *VpnTunnel) (map[string]interface{}, error) {
	m := make(map[string]interface{})
	res := f
	_ = res
	if v := f.Labels; dcl.ValueShouldBeSent(v) {
		m["labels"] = v
	}
	if v := f.Name; dcl.ValueShouldBeSent(v) {
		m["name"] = v
	}
	if v := f.Description; dcl.ValueShouldBeSent(v) {
		m["description"] = v
	}
	if v := f.Location; dcl.ValueShouldBeSent(v) {
		m["region"] = v
	}
	if v := f.TargetVpnGateway; dcl.ValueShouldBeSent(v) {
		m["targetVpnGateway"] = v
	}
	if v := f.VpnGateway; dcl.ValueShouldBeSent(v) {
		m["vpnGateway"] = v
	}
	if v := f.VpnGatewayInterface; v != nil {
		m["vpnGatewayInterface"] = v
	}
	if v := f.PeerExternalGateway; dcl.ValueShouldBeSent(v) {
		m["peerExternalGateway"] = v
	}
	if v := f.PeerExternalGatewayInterface; dcl.ValueShouldBeSent(v) {
		m["peerExternalGatewayInterface"] = v
	}
	if v := f.PeerGcpGateway; dcl.ValueShouldBeSent(v) {
		m["peerGcpGateway"] = v
	}
	if v, err := dcl.DeriveField("projects/%s/regions/%s/routers/%s", f.Router, dcl.SelfLinkToName(f.Project), dcl.SelfLinkToName(f.Location), dcl.SelfLinkToName(f.Router)); err != nil {
		return nil, fmt.Errorf("error expanding Router into router: %w", err)
	} else if !dcl.IsEmptyValueIndirect(v) {
		m["router"] = v
	}
	if v := f.PeerIP; dcl.ValueShouldBeSent(v) {
		m["peerIp"] = v
	}
	if v := f.SharedSecret; dcl.ValueShouldBeSent(v) {
		m["sharedSecret"] = v
	}
	if v := f.IkeVersion; dcl.ValueShouldBeSent(v) {
		m["ikeVersion"] = v
	}
	if v := f.LocalTrafficSelector; v != nil {
		m["localTrafficSelector"] = v
	}
	if v := f.RemoteTrafficSelector; v != nil {
		m["remoteTrafficSelector"] = v
	}
	if v, err := dcl.EmptyValue(); err != nil {
		return nil, fmt.Errorf("error expanding Project into project: %w", err)
	} else if !dcl.IsEmptyValueIndirect(v) {
		m["project"] = v
	}

	return m, nil
}

// flattenVpnTunnel flattens VpnTunnel from a JSON request object into the
// VpnTunnel type.
func flattenVpnTunnel(c *Client, i interface{}, res *VpnTunnel) *VpnTunnel {
	m, ok := i.(map[string]interface{})
	if !ok {
		return nil
	}
	if len(m) == 0 {
		return nil
	}

	resultRes := &VpnTunnel{}
	resultRes.Labels = dcl.FlattenKeyValuePairs(m["labels"])
	resultRes.Id = dcl.FlattenInteger(m["id"])
	resultRes.Name = dcl.FlattenString(m["name"])
	resultRes.Description = dcl.FlattenString(m["description"])
	resultRes.Location = dcl.FlattenString(m["region"])
	resultRes.TargetVpnGateway = dcl.FlattenString(m["targetVpnGateway"])
	resultRes.VpnGateway = dcl.FlattenString(m["vpnGateway"])
	resultRes.VpnGatewayInterface = dcl.FlattenInteger(m["vpnGatewayInterface"])
	resultRes.PeerExternalGateway = dcl.FlattenString(m["peerExternalGateway"])
	resultRes.PeerExternalGatewayInterface = dcl.FlattenInteger(m["peerExternalGatewayInterface"])
	resultRes.PeerGcpGateway = dcl.FlattenString(m["peerGcpGateway"])
	resultRes.Router = dcl.FlattenString(m["router"])
	resultRes.PeerIP = dcl.FlattenString(m["peerIp"])
	resultRes.SharedSecret = dcl.FlattenSecretValue(m["sharedSecret"])
	resultRes.SharedSecretHash = dcl.FlattenString(m["sharedSecretHash"])
	resultRes.Status = flattenVpnTunnelStatusEnum(m["status"])
	resultRes.SelfLink = dcl.FlattenString(m["selfLink"])
	resultRes.IkeVersion = dcl.FlattenInteger(m["ikeVersion"])
	if _, ok := m["ikeVersion"]; !ok {
		c.Config.Logger.Info("Using default value for ikeVersion")
		resultRes.IkeVersion = dcl.Int64(2)
	}
	resultRes.DetailedStatus = dcl.FlattenString(m["detailedStatus"])
	resultRes.LocalTrafficSelector = dcl.FlattenStringSlice(m["localTrafficSelector"])
	resultRes.RemoteTrafficSelector = dcl.FlattenStringSlice(m["remoteTrafficSelector"])
	resultRes.Project = dcl.FlattenString(m["project"])

	return resultRes
}

// flattenVpnTunnelStatusEnumMap flattens the contents of VpnTunnelStatusEnum from a JSON
// response object.
func flattenVpnTunnelStatusEnumMap(c *Client, i interface{}, res *VpnTunnel) map[string]VpnTunnelStatusEnum {
	a, ok := i.(map[string]interface{})
	if !ok {
		return map[string]VpnTunnelStatusEnum{}
	}

	if len(a) == 0 {
		return map[string]VpnTunnelStatusEnum{}
	}

	items := make(map[string]VpnTunnelStatusEnum)
	for k, item := range a {
		items[k] = *flattenVpnTunnelStatusEnum(item.(interface{}))
	}

	return items
}

// flattenVpnTunnelStatusEnumSlice flattens the contents of VpnTunnelStatusEnum from a JSON
// response object.
func flattenVpnTunnelStatusEnumSlice(c *Client, i interface{}, res *VpnTunnel) []VpnTunnelStatusEnum {
	a, ok := i.([]interface{})
	if !ok {
		return []VpnTunnelStatusEnum{}
	}

	if len(a) == 0 {
		return []VpnTunnelStatusEnum{}
	}

	items := make([]VpnTunnelStatusEnum, 0, len(a))
	for _, item := range a {
		items = append(items, *flattenVpnTunnelStatusEnum(item.(interface{})))
	}

	return items
}

// flattenVpnTunnelStatusEnum asserts that an interface is a string, and returns a
// pointer to a *VpnTunnelStatusEnum with the same value as that string.
func flattenVpnTunnelStatusEnum(i interface{}) *VpnTunnelStatusEnum {
	s, ok := i.(string)
	if !ok {
		return nil
	}

	return VpnTunnelStatusEnumRef(s)
}

// This function returns a matcher that checks whether a serialized resource matches this resource
// in its parameters (as defined by the fields in a Get, which definitionally define resource
// identity).  This is useful in extracting the element from a List call.
func (r *VpnTunnel) matcher(c *Client) func([]byte) bool {
	return func(b []byte) bool {
		cr, err := unmarshalVpnTunnel(b, c, r)
		if err != nil {
			c.Config.Logger.Warning("failed to unmarshal provided resource in matcher.")
			return false
		}
		nr := r.urlNormalized()
		ncr := cr.urlNormalized()
		c.Config.Logger.Infof("looking for %v\nin %v", nr, ncr)

		if nr.Project == nil && ncr.Project == nil {
			c.Config.Logger.Info("Both Project fields null - considering equal.")
		} else if nr.Project == nil || ncr.Project == nil {
			c.Config.Logger.Info("Only one Project field is null - considering unequal.")
			return false
		} else if *nr.Project != *ncr.Project {
			return false
		}
		if nr.Location == nil && ncr.Location == nil {
			c.Config.Logger.Info("Both Location fields null - considering equal.")
		} else if nr.Location == nil || ncr.Location == nil {
			c.Config.Logger.Info("Only one Location field is null - considering unequal.")
			return false
		} else if *nr.Location != *ncr.Location {
			return false
		}
		if nr.Name == nil && ncr.Name == nil {
			c.Config.Logger.Info("Both Name fields null - considering equal.")
		} else if nr.Name == nil || ncr.Name == nil {
			c.Config.Logger.Info("Only one Name field is null - considering unequal.")
			return false
		} else if *nr.Name != *ncr.Name {
			return false
		}
		return true
	}
}

type vpnTunnelDiff struct {
	// The diff should include one or the other of RequiresRecreate or UpdateOp.
	RequiresRecreate bool
	UpdateOp         vpnTunnelApiOperation
	FieldName        string // used for error logging
}

func convertFieldDiffsToVpnTunnelDiffs(config *dcl.Config, fds []*dcl.FieldDiff, opts []dcl.ApplyOption) ([]vpnTunnelDiff, error) {
	opNamesToFieldDiffs := make(map[string][]*dcl.FieldDiff)
	// Map each operation name to the field diffs associated with it.
	for _, fd := range fds {
		for _, ro := range fd.ResultingOperation {
			if fieldDiffs, ok := opNamesToFieldDiffs[ro]; ok {
				fieldDiffs = append(fieldDiffs, fd)
				opNamesToFieldDiffs[ro] = fieldDiffs
			} else {
				config.Logger.Infof("%s required due to diff: %v", ro, fd)
				opNamesToFieldDiffs[ro] = []*dcl.FieldDiff{fd}
			}
		}
	}
	var diffs []vpnTunnelDiff
	// For each operation name, create a vpnTunnelDiff which contains the operation.
	for opName, fieldDiffs := range opNamesToFieldDiffs {
		// Use the first field diff's field name for logging required recreate error.
		diff := vpnTunnelDiff{FieldName: fieldDiffs[0].FieldName}
		if opName == "Recreate" {
			diff.RequiresRecreate = true
		} else {
			apiOp, err := convertOpNameToVpnTunnelApiOperation(opName, fieldDiffs, opts...)
			if err != nil {
				return diffs, err
			}
			diff.UpdateOp = apiOp
		}
		diffs = append(diffs, diff)
	}
	return diffs, nil
}

func convertOpNameToVpnTunnelApiOperation(opName string, fieldDiffs []*dcl.FieldDiff, opts ...dcl.ApplyOption) (vpnTunnelApiOperation, error) {
	switch opName {

	case "updateVpnTunnelSetLabelsOperation":
		return &updateVpnTunnelSetLabelsOperation{FieldDiffs: fieldDiffs}, nil

	default:
		return nil, fmt.Errorf("no such operation with name: %v", opName)
	}
}

func extractVpnTunnelFields(r *VpnTunnel) error {
	return nil
}

func postReadExtractVpnTunnelFields(r *VpnTunnel) error {
	return nil
}


text:
/*******************************************************
 *
 * Author: Hirokazu Kato
 *
 *         kato@sys.im.hiroshima-cu.ac.jp
 *
 * Revision: 4.5
 * Date: 2002/01/01
 *
 * 2004/11/17 Grasset  adding new parameters for better controls of
 * V4L driver
 * 2004/11/17 Grasset  adding patch done by XXX for supporting YUV 4:2:0
 * (adding #define and videoBuffer encoding parameters)

*******************************************************/
#ifndef AR_VIDEO_LINUX_V4L_H
#define AR_VIDEO_LINUX_V4L_H
#ifdef  __cplusplus
extern "C" {
#endif

#include <stdlib.h>
#include <linux/types.h>
//#include <linux/videodev.h>
#include <libv4l1-videodev.h>

#include <AR/config.h>
#include <AR/ar.h>

typedef struct {
  //device controls
    char                dev[256];
    int                 channel;
    int                 width;
    int                 height;
    int			palette;
  //image controls
    double              brightness;
    double              contrast;
    double              saturation;
    double              hue;
    double              whiteness;

  //options controls
    int                 mode;

    int                 debug;

    int                 fd;
    int                 video_cont_num;
    ARUint8             *map;
    ARUint8             *videoBuffer;
    struct video_mbuf   vm;
    struct video_mmap   vmm;
} AR2VideoParamT;

#ifdef  __cplusplus
}
#endif
#endif


text:
FSMacros
========

A collection of macros to make Objective-C development easier.

###Usage

Copy **FSMacros.h** into your Xcode project and include it: `#import  "FSMacros.h"`.

###Macros included

Look into **FSMacro.h** for full list of available macros.


text:
module Clementine
  extend self
  @options = {}
  attr_accessor :options

  def ruby2clj(key)
    key.sub(/_/, '-')
  end
end


text:
تسجيل

إضافة تفاصيل إلى حسابك

          <input autocorrect="off" autocapitalize="words" type="text" id="first_name" placeholder="الاسم الأول" required>

          <input autocorrect="off" autocapitalize="words" type="text" id="last_name" placeholder="اسم العائلة" required>

          <input autocorrect="off" autocapitalize="off" type="email" id="email_address" placeholder="عنوان البريد الإلكتروني" required>

          <input autocorrect="off" autocapitalize="off" type="text" id="username" placeholder="اسم المستخدم" required>

            تاريخ الميلاد:

            <input id='dataofbirth' autocorrect="off" autocapitalize="off" type="date" id="date_of_birth" required>

          <input autocorrect="off" autocapitalize="words" type="text" id="city" placeholder="مدينة" required>

          <input autocorrect="off" autocapitalize="off" type="text" id="address1" placeholder="عنوان" required>

            بلد:

            <select name="state" size="1" id="state">
              <option value="1">العربية السعودية</option>
              <option value="2">الكويت</option>
              <option value="3">البحرين</option>
              <option value="4">الأمارات العربية المتحدة</option>
              <option value="5">يمني</option>
              <option value="6">العراق</option>
              <option value="7">سوريا</option>
              <option value="8">عمان</option>
              <option value="9">لبنان</option>
              <option value="10">فلسطين</option>
              <option value="11">الأردن</option>
              <option value="12">مصر</option>
              <option value="13">ليبيا</option>
              <option value="14">تونس</option>
              <option value="15">الجزائر</option>
              <option value="16">مغربي</option>
            </select>

          <input autocorrect="off" autocapitalize="off" type="text" id="zip_code" placeholder="الرمز البريدي" required>

          <input type="password" id="password" placeholder="كلمة السر" required>

          <input type="password" id="password2" placeholder="تكرار كلمة المرور" required>

"هنا جميع المتطلبات القانونية من شأنه أن يضع الشخص العادي للنوم ولكن الذي نتوقع أن يكون لديك تعاني من خلال القراءة إذا كنت ترغب في المضي قدما.

            أنا أوافق على هذه الشروط.

            <input type="checkbox">

      انضم


text:
using J2N.Text;
using System;
using System.Runtime.CompilerServices;

namespace Lucene.Net.Index
{

    using DocValuesConsumer = Lucene.Net.Codecs.DocValuesConsumer;
    using Similarity = Lucene.Net.Search.Similarities.Similarity;

    internal sealed class NormsConsumerPerField : InvertedDocEndConsumerPerField, IComparable<NormsConsumerPerField>
    {
        private readonly FieldInfo fieldInfo;
        private readonly DocumentsWriterPerThread.DocState docState;
        private readonly Similarity similarity;
        private readonly FieldInvertState fieldState;
        private NumericDocValuesWriter consumer;

        public NormsConsumerPerField(DocInverterPerField docInverterPerField, FieldInfo fieldInfo /*, NormsConsumer parent // LUCENENET: Not referenced */)
        {
            this.fieldInfo = fieldInfo;
            docState = docInverterPerField.docState;
            fieldState = docInverterPerField.fieldState;
            similarity = docState.similarity;
        }

        public int CompareTo(NormsConsumerPerField other)
        {
            return fieldInfo.Name.CompareToOrdinal(other.fieldInfo.Name);
        }

        internal override void Finish()
        {
            if (fieldInfo.IsIndexed && !fieldInfo.OmitsNorms)
            {
                if (consumer is null)
                {
                    fieldInfo.NormType = DocValuesType.NUMERIC;
                    consumer = new NumericDocValuesWriter(fieldInfo, docState.docWriter.bytesUsed, false);
                }
                consumer.AddValue(docState.docID, similarity.ComputeNorm(fieldState));
            }
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        internal void Flush(SegmentWriteState state, DocValuesConsumer normsWriter)
        {
            int docCount = state.SegmentInfo.DocCount;
            if (consumer is null)
            {
                return; // null type - not omitted but not written -
                // meaning the only docs that had
                // norms hit exceptions (but indexed=true is set...)
            }
            consumer.Finish(docCount);
            consumer.Flush(state, normsWriter);
        }

        internal bool IsEmpty => consumer is null;

        [MethodImpl(MethodImplOptions.NoInlining)]
        internal override void Abort()
        {
            //
        }
    }
}